Use TopScoreDocCollector when a descending score sort is requested explicitly

Description

This is just an optimization, or at least something that will result in better performance when is solved.

Environment

None

Activity

Show:
Yoann Rodière
May 14, 2020, 8:09 AM

It's actually not a good idea, as it results in inconsistent values being returned by LuceneSearchQuery.getLuceneSort() and LuceneSearchResult.getTopDocs()}: when the sort is non-null but contains only a sort by descending score, we end up returning top docs while "scoreDocs" are {{ScoreDoc instances instead of the expected FieldDoc instances. This in turn complicates the (user) implementation of merging top docs.

Yoann Rodière
September 21, 2020, 2:11 PM

Reopening because it seems there is some performance to be gained from that change. If that performance improvement is real, I think it's worth introducing some weird behavior when retrieving topDocs, since I don't expect many people will need to do that.

Tested with an Infinispan performance test:

  • TopFieldDocCollector:

  • TopScoreDocCollector:

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Fix versions

Priority

Major
Configure