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

Alessandro Benedetti commented on SOLR-12243:
---------------------------------------------

Hi [~ehaubert], thanks for the reply.

I think the current patch could be completed adding a test that verifies the 
actual query (building) parsing.
The bug affects the query (building) parsing in the end, so, testing on results 
per query can be effective, but it's not testing the bugfix.

Adding something like this should work :



public void 
testEdismaxQueryParsing_multiTermWithPf_shouldParseCorrectPhraseQueries() 
throws Exception {
 Query q = QParser.getParser("foo a b bar","edismax",true, req(params("sow", 
"false","qf", "text^10","pf", "text^10","pf2", "text^5","pf3", 
"text^8"))).getQuery();
 assertEquals("+(" +
 "((text:foo)^10.0) ((text:a)^10.0) ((text:b)^10.0) (((+text:tropical 
+text:cyclone) text:bar)^10.0)) " +
 "((spanNear([text:foo, text:a, text:b, spanOr([spanNear([text:tropical, 
text:cyclone], 0, true), text:bar])], 0, true))^10.0) " +
 "(((text:\"foo a\")^5.0) ((text:\"a b\")^5.0) ((spanNear([text:b, 
spanOr([spanNear([text:tropical, text:cyclone], 0, true), text:bar])], 0, 
true))^5.0)) " +
 "(((text:\"foo a b\")^8.0) ((spanNear([text:a, text:b, 
spanOr([spanNear([text:tropical, text:cyclone], 0, true), text:bar])], 0, 
true))^8.0))", q.toString());

 q = QParser.getParser("foo a b tropical cyclone","edismax",true, 
req(params("qf", "text^10","pf", "text^10","pf2", "text^5","pf3", 
"text^8"))).getQuery();
 assertEquals("+(" +
 "((text:foo)^10.0) ((text:a)^10.0) ((text:b)^10.0) ((text:bar (+text:tropical 
+text:cyclone))^10.0)) " +
 "((spanNear([text:foo, text:a, text:b, spanOr([text:bar, 
spanNear([text:tropical, text:cyclone], 0, true)])], 0, true))^10.0) " +
 "(((text:\"foo a\")^5.0) ((text:\"a b\")^5.0) ((text:\"b tropical\")^5.0)) 
(spanOr([text:bar, spanNear([text:tropical, text:cyclone], 0, true)]))^5.0))" +
 "(((text:\"foo a b\")^8.0) ((text:\"a b tropical\")^8.0) ((spanNear([text:b, 
spanOr([text:bar, spanNear([text:tropical, text:cyclone], 0, true)])], 0, 
true))^8.0))", q.toString());
}

N.B. The second part is failing for pf2, because for the query "foo a b 
tropical cyclone" , pf2 is generating just :
((text:\"foo a\")^5.0) ((text:\"a b\")^5.0) ((text:\"b tropical\")^5.0)), which 
I believe is incorrect as an additional span query should be generated  ( 
(spanOr([text:bar, spanNear([text:tropical, text:cyclone], 0, true)]))^5.0)).
I will investigate further in the next days, just wanted to post it here to the 
community attention :)

> Edismax missing phrase queries when phrases contain multiterm synonyms
> ----------------------------------------------------------------------
>
>                 Key: SOLR-12243
>                 URL: https://issues.apache.org/jira/browse/SOLR-12243
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: query parsers
>    Affects Versions: 7.1
>         Environment: RHEL, MacOS X
> Do not believe this is environment-specific.
>            Reporter: Elizabeth Haubert
>            Priority: Major
>         Attachments: SOLR-12243.patch
>
>
> synonyms.txt:
> allergic, hypersensitive
> aspirin, acetylsalicylic acid
> dog, canine, canis familiris, k 9
> rat, rattus
> request handler:
> <requestHandler name="/test_qparse_error" class="solr.SearchHandler">
>  <lst name="defaults">
> <!-- Query settings -->
>  <str name="defType">edismax</str>
>  <str name="tie"> 0.4</str>
>  <str name="qf">title^100</str>
>  <str name="pf">title~20^5000</str>
>  <str name="pf2">title~11</str>
>  <str name="pf3">title~22^1000</str>
>  <str name="df">text</str>
>  <!-- mm If two or fewer clauses exist, they all must match. 
>  If three to five clauses exist, one can be missing. If six to eight clauses 
> exist, all but three must match. 
>  If more than nine clauses exist, only require 30% to match.-->
>  <str name="mm">3&lt;-1 6&lt;-3 9&lt;30%</str>
>  <str name="q.alt">*:*</str>
>  <str name="rows">25</str>
> </lst>
>  </requestHandler>
> Phrase queries (pf, pf2, pf3) containing "dog" or "aspirin"  against the 
> above list will not be generated.
> "allergic reaction dog" will generate pf2: "allergic reaction", but not 
> pf:"allergic reaction dog", pf2: "reaction dog", or pf3: "allergic reaction 
> dog"
> "aspirin dose in rats" will generate pf3: "dose ? rats" but not pf2: "aspirin 
> dose" or pf3:"aspirin dose ?"
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to