You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Vadim Gindin <vg...@detectum.com> on 2017/12/27 07:43:14 UTC

Wrong ID in explain() method.

Hi all.

I've written a simple plugin, that implements custom scoring logic and
extending `Explanation`. I have some real index data that looks like this:

    "_source": {
          "price": 10000,
          "params_model": "Дверь задняя правая Honda CR-V",
          "categories": [
            {
              "id": 3,
              "shop_category_id": "3",
              "name": "Кузов наружные элементы",
              "level": 1
            },
            {
              "id": 342,
              "shop_category_id": "62",
              "name": "Дверь задняя правая",
              "level": 2
            }
          ],
          "params_vendor": "Honda",
        }

My plugin remembers the document id (that was matched in scorer) to a
collection. When explain(id) is called it checks specified id in this
collection and outputs "matched"/"not matched".

The questions.
0. This document is founded by the plugin, but explain(id) method takes the
wrong ID. Why? It happens in the real installation, but in the test case -
it works fine.
1. ID=342 and others come to explain(id) method. Note, it is not a document
id - it is ID of the nested object (category). Why does it happen?
2. I have a test case, based on ESIntegTestCase. It works fine with this
document. But this document is not founded in the real index.

Regards,
Vadim Gindin

Re: Wrong ID in explain() method.

Posted by Vadim Gindin <vg...@detectum.com>.
Yes, thanks a lot for your help.

Do you mean that id of category must not be transferred to explain? If yes
why it is happen?

Regards
Vadim Gindin

29 дек. 2017 г. 14:22 пользователь "Mikhail Khludnev" <mk...@apache.org>
написал:

> Responded on the elastic forum. Have you seen it?
>
>
> On Fri, Dec 29, 2017 at 9:25 AM, Vadim Gindin <vg...@detectum.com>
> wrote:
>
> > If I check
> >
> > GET myindex/mytype/342
> >
> > Nothing is found.
> >
> > I suppose there is a name conflict and Lucene erroneously finds "id" of
> > a nested object (category from a list) and erroneously assumes that it is
> > an ID of a whole document.
> >
> > Is that possible? Is "id" string is reserved word for Lucene?
> >
> > Regards,
> > Vadim Gindin
> >
> > On Wed, Dec 27, 2017 at 12:43 PM, Vadim Gindin <vg...@detectum.com>
> > wrote:
> >
> > > Hi all.
> > >
> > > I've written a simple plugin, that implements custom scoring logic and
> > > extending `Explanation`. I have some real index data that looks like
> > this:
> > >
> > >     "_source": {
> > >           "price": 10000,
> > >           "params_model": "Дверь задняя правая Honda CR-V",
> > >           "categories": [
> > >             {
> > >               "id": 3,
> > >               "shop_category_id": "3",
> > >               "name": "Кузов наружные элементы",
> > >               "level": 1
> > >             },
> > >             {
> > >               "id": 342,
> > >               "shop_category_id": "62",
> > >               "name": "Дверь задняя правая",
> > >               "level": 2
> > >             }
> > >           ],
> > >           "params_vendor": "Honda",
> > >         }
> > >
> > > My plugin remembers the document id (that was matched in scorer) to a
> > > collection. When explain(id) is called it checks specified id in this
> > > collection and outputs "matched"/"not matched".
> > >
> > > The questions.
> > > 0. This document is founded by the plugin, but explain(id) method takes
> > > the wrong ID. Why? It happens in the real installation, but in the test
> > > case - it works fine.
> > > 1. ID=342 and others come to explain(id) method. Note, it is not a
> > > document id - it is ID of the nested object (category). Why does it
> > happen?
> > > 2. I have a test case, based on ESIntegTestCase. It works fine with
> this
> > > document. But this document is not founded in the real index.
> > >
> > > Regards,
> > > Vadim Gindin
> > >
> >
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: Wrong ID in explain() method.

Posted by Mikhail Khludnev <mk...@apache.org>.
Responded on the elastic forum. Have you seen it?


On Fri, Dec 29, 2017 at 9:25 AM, Vadim Gindin <vg...@detectum.com> wrote:

> If I check
>
> GET myindex/mytype/342
>
> Nothing is found.
>
> I suppose there is a name conflict and Lucene erroneously finds "id" of
> a nested object (category from a list) and erroneously assumes that it is
> an ID of a whole document.
>
> Is that possible? Is "id" string is reserved word for Lucene?
>
> Regards,
> Vadim Gindin
>
> On Wed, Dec 27, 2017 at 12:43 PM, Vadim Gindin <vg...@detectum.com>
> wrote:
>
> > Hi all.
> >
> > I've written a simple plugin, that implements custom scoring logic and
> > extending `Explanation`. I have some real index data that looks like
> this:
> >
> >     "_source": {
> >           "price": 10000,
> >           "params_model": "Дверь задняя правая Honda CR-V",
> >           "categories": [
> >             {
> >               "id": 3,
> >               "shop_category_id": "3",
> >               "name": "Кузов наружные элементы",
> >               "level": 1
> >             },
> >             {
> >               "id": 342,
> >               "shop_category_id": "62",
> >               "name": "Дверь задняя правая",
> >               "level": 2
> >             }
> >           ],
> >           "params_vendor": "Honda",
> >         }
> >
> > My plugin remembers the document id (that was matched in scorer) to a
> > collection. When explain(id) is called it checks specified id in this
> > collection and outputs "matched"/"not matched".
> >
> > The questions.
> > 0. This document is founded by the plugin, but explain(id) method takes
> > the wrong ID. Why? It happens in the real installation, but in the test
> > case - it works fine.
> > 1. ID=342 and others come to explain(id) method. Note, it is not a
> > document id - it is ID of the nested object (category). Why does it
> happen?
> > 2. I have a test case, based on ESIntegTestCase. It works fine with this
> > document. But this document is not founded in the real index.
> >
> > Regards,
> > Vadim Gindin
> >
>



-- 
Sincerely yours
Mikhail Khludnev

Re: Wrong ID in explain() method.

Posted by Vadim Gindin <vg...@detectum.com>.
If I check

GET myindex/mytype/342

Nothing is found.

I suppose there is a name conflict and Lucene erroneously finds "id" of
a nested object (category from a list) and erroneously assumes that it is
an ID of a whole document.

Is that possible? Is "id" string is reserved word for Lucene?

Regards,
Vadim Gindin

On Wed, Dec 27, 2017 at 12:43 PM, Vadim Gindin <vg...@detectum.com> wrote:

> Hi all.
>
> I've written a simple plugin, that implements custom scoring logic and
> extending `Explanation`. I have some real index data that looks like this:
>
>     "_source": {
>           "price": 10000,
>           "params_model": "Дверь задняя правая Honda CR-V",
>           "categories": [
>             {
>               "id": 3,
>               "shop_category_id": "3",
>               "name": "Кузов наружные элементы",
>               "level": 1
>             },
>             {
>               "id": 342,
>               "shop_category_id": "62",
>               "name": "Дверь задняя правая",
>               "level": 2
>             }
>           ],
>           "params_vendor": "Honda",
>         }
>
> My plugin remembers the document id (that was matched in scorer) to a
> collection. When explain(id) is called it checks specified id in this
> collection and outputs "matched"/"not matched".
>
> The questions.
> 0. This document is founded by the plugin, but explain(id) method takes
> the wrong ID. Why? It happens in the real installation, but in the test
> case - it works fine.
> 1. ID=342 and others come to explain(id) method. Note, it is not a
> document id - it is ID of the nested object (category). Why does it happen?
> 2. I have a test case, based on ESIntegTestCase. It works fine with this
> document. But this document is not founded in the real index.
>
> Regards,
> Vadim Gindin
>