You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by AshB <bi...@gmail.com> on 2018/11/04 09:13:29 UTC

Phrase query as feature in LTR not working

Phrase query is not working when applied in LTR.

Feature supplied is
 {
    "name" : "isPook",
    "class" : "org.apache.solr.ltr.feature.SolrFeature",
    "params" : {
      "fq": ["{!type=edismax qf=text v=$qq}&qq=\"${query}\""]
    }
  }

Tested this feature outside and it returns only one result ,i.e phrase but
with LTR it is matching on terms

http://localhost:8983/solr/techproducts/query?q=game%20of%20thrones&fl=id,name,[features%20*efi.query=thrones%20of%20game*],name,cat&debug=true

"response":{"numFound":6,"start":0,"docs":[
      {
        "id":"05535734023",
        "cat":["book"],
        "name":"A Thrones of Game",
       
"[features]":"documentRecency=0.02011838,isBook=1.0,*isPook=1.0*,originalScore=8.337603"},
      {
        "id":"05535734021",
        "cat":["book"],
        "name":"A Game of meeting Thrones",
       
"[features]":"documentRecency=0.02011838,isBook=1.0,*isPook=1.0*,originalScore=8.179235"},

How to set the feature so that it score only the first document containing
the phrase




--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Phrase query as feature in LTR not working

Posted by Alessandro Benedetti <a....@sease.io>.
Hi AshB, from what I see, this is the expected behavior.

You pass this efi to your "isPook" feature : efi.query=thrones%20of%20game*.
Then you calculate:

{ 
    "name" : "isPook", 
    "class" : "org.apache.solr.ltr.feature.SolrFeature", 
    "params" : { 
      "fq": ["{!type=edismax qf=*text* v=$qq}&qq=\"${query}\""] 
    } 
  } 

Given the document titles, it seems incorrect, but what about the document
text ?
Furthermore, if you are interested in exact phrase match, I would first go
with :

https://lucene.apache.org/solr/guide/6_6/other-parsers.html#OtherParsers-FieldQueryParser

and then  play with the following if more advance phrase querying was
needed: 

https://lucene.apache.org/solr/guide/6_6/other-parsers.html#OtherParsers-ComplexPhraseQueryParser

Cheers




-----
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html