You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by hoooeqry <ho...@protonmail.com.INVALID> on 2022/03/02 15:58:31 UTC
Block Join Parent Query Parser and Field Aliases
Hello,
I recently moved from Solr 6.5.1 to Solr 8.6.3, and after we finished upgrading we now start updating our API, and the first thing we are doing is changing some of our collections to use nested documents.
At first step, we want to preserve all of the queries to do the same, but with the new documents structure.
---
While writing down the new version of our queries we have heavy use of Block Join Parent Query Parser (for now, we don't have a use of the child version), and I notice 2 problems (which I think are bugs, but they are possibly just me not understanding how the parser works).
The first problem is:
- The parent QParser let me query only using the df field.
Say my df=id.
Then{!parent which="-_nest_path_:* *:*"}holo parse into+AllParentsAware(ToParentBlockJoinQuery(+id:holo)).
But {!parent which="-_nest_path_:* *:*"}content_txt:holo parse into+AllParentsAware(ToParentBlockJoinQuery(+id:content_txt:holo)).
Am I searching it wrong? Or is there a bug?
The second problem is a bit more serious:
- I am using edismax parser (with uf=* _query_ and sow=true), and we use a lot of field aliases. Including our df parameters. The parent QParser doesn't work correctly when my df is a field alias.
For example for f.alias.qf=id we get that {!parent which="-_nest_path_:* *:*"}holo is parsed into: `+(DisjunctionMaxQuery(((id:{parent))) DisjunctionMaxQuery(((id:which="-_nest_path_:*))) DisjunctionMaxQuery(((id:*:*\}holo)))`
It looks like edismax is getting an error, so it takes {!parent which="-_nest_path_:* *:*"}holo as the query itself!
I would love to get an advice on what to do (if it is indeed a bug, I am willing to go into the code and try to fix it, but I am hoping to solve it without patching our Solr)
Sent with [ProtonMail](https://protonmail.com/) Secure Email.
Re: Block Join Parent Query Parser and Field Aliases
Posted by hoooeqry <ho...@protonmail.com.INVALID>.
We found a walk around.
It appears that the BJPQParser does not support a lot functionality (e.g. field aliases, search on specific fields, and it even has a bug on multi-words search), but it does support sub-QParsers (assuming the the "root" parser allows them, e.g. with edismax + _query_ magic field) so the method we are using is:
`({!parent which="..."}{!edismax v='<search expression>'})` (the parentheses are important if this expression is not the only expression in the query/fq)
Doing `{!parent which="..."}{!edismax df='<field>'}<search word>` also works, but if we replace <search word> with <search phrase> or <search expression> it breaks under certain conditions
Sent with ProtonMail Secure Email.
------- Original Message -------
On Wednesday, March 2nd, 2022 at 5:58 PM, hoooeqry <ho...@protonmail.com.INVALID> wrote:
> Hello,
>
> I recently moved from Solr 6.5.1 to Solr 8.6.3, and after we finished upgrading we now start updating our API, and the first thing we are doing is changing some of our collections to use nested documents.
>
> At first step, we want to preserve all of the queries to do the same, but with the new documents structure.
>
> ---
>
> While writing down the new version of our queries we have heavy use of Block Join Parent Query Parser (for now, we don't have a use of the child version), and I notice 2 problems (which I think are bugs, but they are possibly just me not understanding how the parser works).
>
> The first problem is:
>
> - The parent QParser let me query only using the df field.
>
> Say my df=id.
>
> Then{!parent which="-nest_path:* :"}holo parse into+AllParentsAware(ToParentBlockJoinQuery(+id:holo)).
>
> But {!parent which="-nest_path:* :"}content_txt:holo parse into+AllParentsAware(ToParentBlockJoinQuery(+id:content_txt:holo)).
>
> Am I searching it wrong? Or is there a bug?
>
> The second problem is a bit more serious:
>
> - I am using edismax parser (with uf=* query and sow=true), and we use a lot of field aliases. Including our df parameters. The parent QParser doesn't work correctly when my df is a field alias.
>
> For example for f.alias.qf=id we get that {!parent which="-nest_path:* :"}holo is parsed into: `+(DisjunctionMaxQuery(((id:{parent))) DisjunctionMaxQuery(((id:which="-_nest_path_:*))) DisjunctionMaxQuery(((id:*:*\\}holo)))`
>
> It looks like edismax is getting an error, so it takes {!parent which="-nest_path:* :"}holo as the query itself!
>
> I would love to get an advice on what to do (if it is indeed a bug, I am willing to go into the code and try to fix it, but I am hoping to solve it without patching our Solr)
>
> Sent with ProtonMail Secure Email.