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 Chris Hostetter <ho...@fucit.org> on 2018/09/17 21:09:32 UTC

Re: Boost matches occurring early in the field (offset)

: I have seen that one. But as I understand spanFirst, it only allows you 
: to define a boost if your span matches, i.e. not a gradually lower score 
: the further down in the document the match is?

I believe you are incorrect.

Unless something has drastically changed in SpanQuery in the past few 
years, all SpanQueries automatically "boost" the resulting scores of 
matching documents based on the "width" of the spans that match -- similar 
to how a phrase query with a high slop value will score higher for a doc 
with one "tight" match then on a doc with one "loose" match...

https://lucene.apache.org/core/7_4_0/core/org/apache/lucene/search/similarities/Similarity.SimScorer.html

So in the specific case of SpanFirst -- any matching span is not 
only anchored (on the left) at the start of the field value, and (on the 
right) by at most max term position value specified, but the closer the 
sub-span match is to the start of the field value, the smaller the 
resulting Span, and the higher the score.

(If this general relationsihp of Span "width" to score isn't clear from 
the high level jdocs, then it should probably be called out better? ... 
i'm not sure if it's particulalry clear/obvious inthe PhraseQuery jdocs 
either)



-Hoss
http://www.lucidworks.com/