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 krishan goyal <kr...@gmail.com> on 2020/09/08 09:32:54 UTC

Re: Creating a phrase match feature in LTR

Thanks Dmitry.

Using
 "q": "{!complexphrase inOrder=true}fieldName:${input}"
works for single token queries but raises same exception when input is
multi token

Using
"q": "{!complexphrase inOrder=true df=fieldName}${input}"
works for all types of tokens but the scoring logic isn't the same as "pf"
or as using the same query via query reranking -
rqq: "{!complexphrase inOrder=true v=$v1}",
v1: "query(fieldName:"some text"^1.0)",

Eg:
query: "nike red shoes"
I expect the phrase score to be 0 if the tokens are not in order in the
document or if any one token is absent in the document.

This is the score returned based on document and the type of reranking

Document LTR score
Reranking score
"nike red shoes" 3 3
"nike caps" 1 0
"nike shoes red" 3 0
What is the cause for LTR score to not match query reranking score


On Fri, Aug 28, 2020 at 11:17 PM Dmitry Kan <so...@gmail.com> wrote:

> Hi Krishan,
>
> What if you remove the query() wrapping?
>
> {
>   "name": "phraseMatch",
>   "class": "org.apache.solr.ltr.feature.SolrFeature",
>   "params": {
>     "q": "{!complexphrase inOrder=true}fieldName:${input}"
>   },
>   "store": "_DEFAULT_"
> }
>
> or even:
>
> {
>   "name": "phraseMatch",
>   "class": "org.apache.solr.ltr.feature.SolrFeature",
>   "params": {
>     "q": "{!complexphrase inOrder=true df=fieldName}${input}"
>   },
>   "store": "_DEFAULT_"
> }
>
>
> On Tue, Aug 25, 2020 at 9:59 AM krishan goyal <kr...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I am trying to create a phrase match feature (what "pf" does in
> > dismax/edismax parsers)
> >
> > I've tried various ways to set it up
> >
> > {
> >   "name": "phraseMatch",
> >   "class": "org.apache.solr.ltr.feature.SolrFeature",
> >   "params": {
> >     "q": "{!complexphrase inOrder=true}query(fieldName:${input})"
> >   },
> >   "store": "_DEFAULT_"
> > }
> >
> > This fails with the exception
> >
> > Exception from createWeight for SolrFeature [name=phraseMatch,
> > params={q={!complexphrase inOrder=true}query(fieldName:${input})}] null
> >
> > But similar query works when used in the query reranking construct with
> > these params
> >
> > rqq: "{!complexphrase inOrder=true v=$v1}",
> > v1: "query(fieldName:"some text"~2^1.0,0)",
> >
> > What is the problem in the LTR configuration for the feature ?
> >
>
>
> --
> Dmitry Kan
> Luke Toolbox: http://github.com/DmitryKey/luke
> Blog: http://dmitrykan.blogspot.com
> Twitter: http://twitter.com/dmitrykan
> SemanticAnalyzer: https://semanticanalyzer.info
>

Re: Creating a phrase match feature in LTR

Posted by krishan goyal <kr...@gmail.com>.
Hi,

Can anyone help me on this ? I am stuck on this for days.

On Tue, Sep 8, 2020 at 3:02 PM krishan goyal <kr...@gmail.com> wrote:

> Thanks Dmitry.
>
> Using
>  "q": "{!complexphrase inOrder=true}fieldName:${input}"
> works for single token queries but raises same exception when input is
> multi token
>
> Using
> "q": "{!complexphrase inOrder=true df=fieldName}${input}"
> works for all types of tokens but the scoring logic isn't the same as "pf"
> or as using the same query via query reranking -
> rqq: "{!complexphrase inOrder=true v=$v1}",
> v1: "query(fieldName:"some text"^1.0)",
>
> Eg:
> query: "nike red shoes"
> I expect the phrase score to be 0 if the tokens are not in order in the
> document or if any one token is absent in the document.
>
> This is the score returned based on document and the type of reranking
>
> Document LTR score
> Reranking score
> "nike red shoes" 3 3
> "nike caps" 1 0
> "nike shoes red" 3 0
> What is the cause for LTR score to not match query reranking score
>
>
> On Fri, Aug 28, 2020 at 11:17 PM Dmitry Kan <so...@gmail.com> wrote:
>
>> Hi Krishan,
>>
>> What if you remove the query() wrapping?
>>
>> {
>>   "name": "phraseMatch",
>>   "class": "org.apache.solr.ltr.feature.SolrFeature",
>>   "params": {
>>     "q": "{!complexphrase inOrder=true}fieldName:${input}"
>>   },
>>   "store": "_DEFAULT_"
>> }
>>
>> or even:
>>
>> {
>>   "name": "phraseMatch",
>>   "class": "org.apache.solr.ltr.feature.SolrFeature",
>>   "params": {
>>     "q": "{!complexphrase inOrder=true df=fieldName}${input}"
>>   },
>>   "store": "_DEFAULT_"
>> }
>>
>>
>> On Tue, Aug 25, 2020 at 9:59 AM krishan goyal <kr...@gmail.com>
>> wrote:
>>
>> > Hi,
>> >
>> > I am trying to create a phrase match feature (what "pf" does in
>> > dismax/edismax parsers)
>> >
>> > I've tried various ways to set it up
>> >
>> > {
>> >   "name": "phraseMatch",
>> >   "class": "org.apache.solr.ltr.feature.SolrFeature",
>> >   "params": {
>> >     "q": "{!complexphrase inOrder=true}query(fieldName:${input})"
>> >   },
>> >   "store": "_DEFAULT_"
>> > }
>> >
>> > This fails with the exception
>> >
>> > Exception from createWeight for SolrFeature [name=phraseMatch,
>> > params={q={!complexphrase inOrder=true}query(fieldName:${input})}] null
>> >
>> > But similar query works when used in the query reranking construct with
>> > these params
>> >
>> > rqq: "{!complexphrase inOrder=true v=$v1}",
>> > v1: "query(fieldName:"some text"~2^1.0,0)",
>> >
>> > What is the problem in the LTR configuration for the feature ?
>> >
>>
>>
>> --
>> Dmitry Kan
>> Luke Toolbox: http://github.com/DmitryKey/luke
>> Blog: http://dmitrykan.blogspot.com
>> Twitter: http://twitter.com/dmitrykan
>> SemanticAnalyzer: https://semanticanalyzer.info
>>
>