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 ilayaraja <il...@gmail.com> on 2018/03/15 11:31:56 UTC

LTR - OriginalScore query issue

solr/collection/select?fl=id,score,[features+store=myFeatureStore+efi.user_query='black
shoes']&wt=json&q=id:"13245336"&debugQuery=on

When we fire this query during feature extraction, the originalScore feature
gets the score of the "id" match but not the actual user query which is in
this case 'black shoes'.

The feature definition is in features.json:
 {
      "name":"originalScore",
      "class":"org.apache.solr.ltr.feature.OriginalScoreFeature",
      "params":null,
      "store":"myFeatureStore"}

Is it the expected behaviour? I do not watch the tf/idf score for matching
the id, rather I would want to match score for the query w.r.t. that item.




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

Re: LTR - OriginalScore query issue

Posted by Alessandro Benedetti <a....@sease.io>.
From Apache Solr tests :

loadFeature(
        "SomeEdisMax",
        SolrFeature.class.getCanonicalName(),
        "{\"q\":\"{!edismax qf='title description' pf='description' mm=100%
boost='pow(popularity, 0.1)' v='w1' tie=0.1}\"}");


*qf='title description'*

Can you try again using the proper expected syntax ( with single quotes).
If it doesn't work we may need to raise it as a bug.

Regards



-----
---------------
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

Re: LTR - OriginalScore query issue

Posted by ilayaraja <il...@gmail.com>.
Yes, I have tried that too:

But it was throwing error while feature extraction:
 "Exception from createWeight for SolrFeature [name=originalLuceneScore,
params={q={!dismax qf=tem_type_all^30.0 ......}${user_query}}] Failed to
parse feature query.
	at
org.apache.solr.ltr.LTRScoringQuery.createWeights(LTRScoringQuery.java:241)
	at
org.apache.solr.ltr.LTRScoringQuery.createWeight(LTRScoringQuery.java:208)
	at
org.apache.solr.ltr.response.transform.LTRFeatureLoggerTransformerFactory$FeatureTransformer.setContext(LTRFeatureLoggerTransformerFactory.java:245)
	at
org.apache.solr.response.transform.DocTransformers.setContext(DocTransformers.java:69)
	at org.apache.solr.response.DocsStreamer.<init>(DocsStreamer.java:89)
	at
org.apache.solr.response.ResultContext.getProcessedDocuments(ResultContext.java:55)
	at
org.apache.solr.response.TextResponseWriter.writeDocuments(TextResponseWriter.java:260)



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

Re: LTR - OriginalScore query issue

Posted by Alessandro Benedetti <a....@sease.io>.
I understood your requirement,
the SolrFeature feature type should be quite flexible,
have you tried :

{ 
name: "overallEdismaxScore", 
class: "org.apache.solr.ltr.feature.SolrFeature", 
params: { 
q: "{!dismax qf=item_typel^3.0 brand^2.0 title^5.0}${user_query}" 
}, 
store: "myFeatureStoreDemo", 
} 

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

Re: LTR - OriginalScore query issue

Posted by ilayaraja <il...@gmail.com>.
I do have the features defined as below for field specific (title..) matching
etc:

features: [
{
name: "productNewness",
class: "org.apache.solr.ltr.feature.SolrFeature",
params: {
q: "{!func}recip( ms(NOW,launchdate_pl), 3.16e-11, 1, 1)"
},
store: "myFeatureStoreDemo",
},
{
name: "originalScore",
class: "org.apache.solr.ltr.feature.OriginalScoreFeature",
params: null,
store: "myFeatureStoreDemo",
},
{
name: "productTitleMatchGuestQuery",
class: "org.apache.solr.ltr.feature.SolrFeature",
params: {
q: "{!dismax qf=p_title}${user_query}"
},
store: "myFeatureStoreDemo",
}
]



What I am looking for is the original score for that document given the
query (efi.user_query) before re-ranking i.e. as per the "qf" defined in the
request handler - that matches different fields with the query:
qf=item_typel^3.0 brand^2.0 title^5.0





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

Re: LTR - OriginalScore query issue

Posted by Alessandro Benedetti <a....@sease.io>.
From the snippet you posted this is the query you run :
q=id:"13245336"

So the original score ( for each document in the result set) can only be the
score associated to that query.

You then pass an EFI with a different text.
You can now use that information to calculate another feature if you want.
You can define a SolrFeature :

{
    "store" : "myFeatureStore",
    "name" : "userTextCat",
    "class" : "org.apache.solr.ltr.feature.SolrFeature",
    "params" : { "q" : "{!<queryparser> <localParams}${user_query}" }
  }

e.g.
{
    "store" : "myFeatureStore",
    "name" : "titleTfIdf",
    "class" : "org.apache.solr.ltr.feature.SolrFeature",
    "params" : { "q" : "{!field f=title}${user_query}" }
  }

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