understanding the relationship between boosting a document in lucene at index time and its corresponding score at search time

前端 未结 1 1855
面向向阳花
面向向阳花 2021-01-07 09:13

When indexing, I boost certain documents, but they do not appear on the top of the list of retrieved documents. I looked at the score of those documents, and somehow, the sc

相关标签:
1条回答
  • 2021-01-07 10:05

    I'm gonna go on a wild guess here since you havent provide a sample of you search code, but a common reason why the score of retreived docs is NaN is because you use a Sort. When sorting, most of the time the score of the documents is not used, and therefore disabled by default.

    If you use a Sort for your search, and want the score, check the method setDefaultFieldSortScoring of the IndexSearcher class. This method allows you to enable scoring the documents in a search that uses a Sort.

    http://lucene.apache.org/java/2_9_4/api/all/org/apache/lucene/search/IndexSearcher.html#setDefaultFieldSortScoring(boolean, boolean)

    0 讨论(0)
提交回复
热议问题