You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by au...@francelabs.com on 2015/09/10 11:43:23 UTC

Use SloppyPhraseScorer in SpanNearQuery

Hi all,

SpanNearQuery and SloppyPhraseQuery can have similar behavior in some 
use cases. On the one hand, I have to distinguish between ordered and 
unordered terms (that’s enabled with SpanNearQuery) but on the other 
hand, I want to use the SloppyPhraseScorer, that takes the relative 
positions of the terms into account for the score calculation. As far I 
understood, this is possible with SloppyPhraseQuery but not with 
SpanNearQuery. Do you think there is there a way to combine these two 
features to have the best of both worlds?

Thanks!

Aurélien

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Use SloppyPhraseScorer in SpanNearQuery

Posted by au...@francelabs.com.
 

Hi Alan, 

Thank you for your answer: it is exactly what I need. 

Regards, 

Aurélien 

On 12.09.2015 11:21, Alan Woodward wrote: 

> If you're using lucene 5.3, you could create a modified version of PayloadScoreQuery that just uses positions rather than payloads to modify the score. 
> 
> Alan Woodward
> www.flax.co.uk [1]
> 
> On 11 Sep 2015, at 17:40, aurelien.mazoyer@francelabs.com wrote: 
> 
> Perfect, thank you :-) 
> 
> I was also wondering if I can take the absolute position of a term in the scoring calculation in my SpanNearQuery but I am not sure I can achieve this efficiently with a custom implementation of Similarity. 
> 
> I am thinking of two ways to achieve this (please tell me if I am wrong...) : 
> 
> - Duplicate the term position in payload and implement the computePayload method in Similirity class in order to make it take the value into account for scoring (I don't like this solution :-) ) 
> 
> - Extends the SpanScorer to take the term position into account for the scoring calculation 
> 
> Do you think that one of these approach is valid or do you have another idea? 
> 
> Thank you, 
> 
> Regards 
> 
> Aurélien MAZOYER 
> 
> On 11.09.2015 09:40, Alan Woodward wrote: Yes, that's correct. 
> 
> Alan Woodward
> www.flax.co.uk [2]
> 
> On 10 Sep 2015, at 17:11, aurelien.mazoyer@francelabs.com wrote: Hi,
> 
> Yes, thanks.
> If I want to customize this behavior (remove it or make it more or less important), is it correct to override the Similarity class to implement a new computeSlopFactor method?
> 
> Thank you for your answer.
> 
> Regards,
> 
> Aurélien MAZOYER
> 
> On 10.09.2015 12:37, Alan Woodward wrote:
> Hi,
> SpanNearQuery will also take into account the 'width' of the match, so
> that terms that are closer together will score more highly. Is that
> what you're looking for?
> Alan Woodward
> www.flax.co.uk [2]
> On 10 Sep 2015, at 10:43, aurelien.mazoyer@francelabs.com wrote:
> Hi all,
> SpanNearQuery and SloppyPhraseQuery can have similar behavior in some use cases. On the one hand, I have to distinguish between ordered and unordered terms (that's enabled with SpanNearQuery) but on the other hand, I want to use the SloppyPhraseScorer, that takes the relative positions of the terms into account for the score calculation. As far I understood, this is possible with SloppyPhraseQuery but not with SpanNearQuery. Do you think there is there a way to combine these two features to have the best of both worlds?
> Thanks!
> Aurélien
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org

 

Links:
------
[1] http://www.flax.co.uk
[2] http://www.flax.co.uk/

Re: Use SloppyPhraseScorer in SpanNearQuery

Posted by au...@francelabs.com.
 

Perfect, thank you :-) 

I was also wondering if I can take the absolute position of a term in
the scoring calculation in my SpanNearQuery but I am not sure I can
achieve this efficiently with a custom implementation of Similarity. 

I am thinking of two ways to achieve this (please tell me if I am
wrong...) : 

- Duplicate the term position in payload and implement the
computePayload method in Similirity class in order to make it take the
value into account for scoring (I don't like this solution :-) ) 

- Extends the SpanScorer to take the term position into account for the
scoring calculation 

Do you think that one of these approach is valid or do you have another
idea? 

Thank you, 

Regards 

Aurélien MAZOYER 

On 11.09.2015 09:40, Alan Woodward wrote: 

> Yes, that's correct. 
> 
> Alan Woodward
> www.flax.co.uk [1]
> 
> On 10 Sep 2015, at 17:11, aurelien.mazoyer@francelabs.com wrote: Hi,
> 
> Yes, thanks.
> If I want to customize this behavior (remove it or make it more or less important), is it correct to override the Similarity class to implement a new computeSlopFactor method?
> 
> Thank you for your answer.
> 
> Regards,
> 
> Aurélien MAZOYER
> 
> On 10.09.2015 12:37, Alan Woodward wrote:
> Hi,
> SpanNearQuery will also take into account the 'width' of the match, so
> that terms that are closer together will score more highly. Is that
> what you're looking for?
> Alan Woodward
> www.flax.co.uk [1]
> On 10 Sep 2015, at 10:43, aurelien.mazoyer@francelabs.com wrote:
> Hi all,
> SpanNearQuery and SloppyPhraseQuery can have similar behavior in some use cases. On the one hand, I have to distinguish between ordered and unordered terms (that's enabled with SpanNearQuery) but on the other hand, I want to use the SloppyPhraseScorer, that takes the relative positions of the terms into account for the score calculation. As far I understood, this is possible with SloppyPhraseQuery but not with SpanNearQuery. Do you think there is there a way to combine these two features to have the best of both worlds?
> Thanks!
> Aurélien
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org

 

Links:
------
[1] http://www.flax.co.uk

Re: Use SloppyPhraseScorer in SpanNearQuery

Posted by au...@francelabs.com.
Hi,

Yes, thanks.
If I want to customize this behavior (remove it or make it more or less 
important), is it correct to override the Similarity class to implement 
a new computeSlopFactor method?

Thank you for your answer.

Regards,

Aurélien MAZOYER



On 10.09.2015 12:37, Alan Woodward wrote:
> Hi,
> 
> SpanNearQuery will also take into account the ‘width’ of the match, so
> that terms that are closer together will score more highly.  Is that
> what you’re looking for?
> 
> Alan Woodward
> www.flax.co.uk
> 
> 
> On 10 Sep 2015, at 10:43, aurelien.mazoyer@francelabs.com wrote:
> 
>> Hi all,
>> 
>> SpanNearQuery and SloppyPhraseQuery can have similar behavior in some 
>> use cases. On the one hand, I have to distinguish between ordered and 
>> unordered terms (that’s enabled with SpanNearQuery) but on the other 
>> hand, I want to use the SloppyPhraseScorer, that takes the relative 
>> positions of the terms into account for the score calculation. As far 
>> I understood, this is possible with SloppyPhraseQuery but not with 
>> SpanNearQuery. Do you think there is there a way to combine these two 
>> features to have the best of both worlds?
>> 
>> Thanks!
>> 
>> Aurélien
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Use SloppyPhraseScorer in SpanNearQuery

Posted by Alan Woodward <al...@flax.co.uk>.
Hi,

SpanNearQuery will also take into account the ‘width’ of the match, so that terms that are closer together will score more highly.  Is that what you’re looking for?

Alan Woodward
www.flax.co.uk


On 10 Sep 2015, at 10:43, aurelien.mazoyer@francelabs.com wrote:

> Hi all,
> 
> SpanNearQuery and SloppyPhraseQuery can have similar behavior in some use cases. On the one hand, I have to distinguish between ordered and unordered terms (that’s enabled with SpanNearQuery) but on the other hand, I want to use the SloppyPhraseScorer, that takes the relative positions of the terms into account for the score calculation. As far I understood, this is possible with SloppyPhraseQuery but not with SpanNearQuery. Do you think there is there a way to combine these two features to have the best of both worlds?
> 
> Thanks!
> 
> Aurélien
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>