Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way for me to change scoring based on term position in Lucene?

for example, if I am searching an index of book titles with the term "harry", "Dirty Harry" is scored equally to "Harry Potter", and when two items are equally scored, the order is random. I'd like to weight the one that begins with my search term (Harry Potter) higher.

I would rather not use TermPostionVector as it seems that this is something I can read only after the search and scoring has been completed.

thanks for your time/consideration.

like image 923
HaterTot Avatar asked Jan 31 '12 22:01

HaterTot


1 Answers

Look up spanquery.

like image 57
Mikos Avatar answered Nov 12 '22 11:11

Mikos