[ 
https://issues.apache.org/jira/browse/SOLR-16953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17761857#comment-17761857
 ] 

Pierre Salagnac commented on SOLR-16953:
----------------------------------------

I already experienced similar issues with {{edismax}} parser in the past 
because of very naive string parsing.

The issue is in pre-parsing (before JavaCC) more specifically in method 
{{{}splitIntoClauses(){}}}. When we have a query like {{{}foo:(aa bb){}}}, it 
correctly parses it into two clauses, but only the first one has a user 
specified field. Second one has {{null}} value for the field.
Then, when we handle the {{pf}} parameter in post-parsing (method 
{{{}addPhraseFieldQueries{}}}), we only consider clauses with a non null field. 
That's why in the above example token {{aa}} is ignored when handling {{pf}} 
parameter while token {{bb}} is taken into account.

> Wrong parsing when using pf parameter
> -------------------------------------
>
>                 Key: SOLR-16953
>                 URL: https://issues.apache.org/jira/browse/SOLR-16953
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>    Affects Versions: 9.2.1
>            Reporter: Monica Marrero
>            Priority: Major
>
> The parsing of the query for the _pf_ parameter is wrong.
> Reference to user mailing list: [Edismax parsing when using pf 
> parameter|https://lists.apache.org/thread/r1ztqzn4hy4fr976wghm2bv9p8sh0cmm]
> Examples using edismax and techproducts collection in Solr v9.2.1,  
> _defType=edismax, pf=text_ _name_ :
>  a) Query= name:george AND (game AND thrones)
>  Result= "parsedquery_toString":"+({+}name:george +({+}(text:game)
>  +(text:thrones))) (text:\"game thrones\" | name:\"game thrones\")"
>  b) Query= name:(george AND martin) AND (game AND thrones)
>  Result= "parsedquery_toString":"{+}({+}(+name:george +name:martin)
>  {+}({+}(text:game) +(text:thrones))) (text:\"{*}martin{*} game thrones\" | 
> name:\"
>  *martin* game thrones\")"
> Test by [~hossman_luc...@fucit.org]:
> $ curl -sS [http://localhost:8983/solr/techproducts/select] -d 'debug=query'
> -d 'defType=edismax' -d 'pf=text name' -d 'q=content:(XXX AND YYY AND ZZZ)
> AND (AAA AND BBB)' | grep '"parsedquery'
>     "parsedquery":"{+}({+}(+content:xxx +content:yyy +content:zzz)
> +(+DisjunctionMaxQuery((text:aaa)) +DisjunctionMaxQuery((text:bbb))))
> DisjunctionMaxQuery((name:\"yyy zzz aaa bbb\" | text:\"yyy zzz aaa
> bbb\"))",
>     "parsedquery_toString":"{+}({+}(+content:xxx +content:yyy +content:zzz)
> {+}({+}(text:aaa) +(text:bbb))) (name:\"yyy zzz aaa bbb\" | text:\"yyy zzz aaa
> bbb\")"



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to