Skip to content

Commit 2c706ba

Browse files
authored
[Backport 2.19] Use ScoreDoc instead of FieldDoc when creating TopScoreDocCollectorManager to avoid unnecessary conversion (#18821)
* Use ScoreDoc instead of FieldDoc when creating TopScoreDocCollectorManager to avoid unnecessary conversion (#18802) * Use ScoreDoc instead of FieldDoc when creating TopScoreDocCollectorManager to avoid unnecessary conversion Signed-off-by: Binlong Gao <[email protected]> * Modify change log Signed-off-by: Binlong Gao <[email protected]> --------- Signed-off-by: Binlong Gao <[email protected]> * Format the code Signed-off-by: Binlong Gao <[email protected]> --------- Signed-off-by: Binlong Gao <[email protected]>
1 parent 17f4d4a commit 2c706ba

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2323
- Null check field names in QueryStringQueryBuilder ([#18194](https://github.com/opensearch-project/OpenSearch/pull/18194))
2424
- Fix illegal argument exception when creating a PIT ([#16781](https://github.com/opensearch-project/OpenSearch/pull/16781))
2525
- Fix the bug of Access denied error when rolling log files ([#18597](https://github.com/opensearch-project/OpenSearch/pull/18597))
26+
- Use ScoreDoc instead of FieldDoc when creating TopScoreDocCollectorManager to avoid unnecessary conversion ([#18802](https://github.com/opensearch-project/OpenSearch/pull/18802))
2627

2728
### Security
2829

server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,8 @@ private static TopDocsCollector<?> createCollector(
360360
int hitCountThreshold
361361
) {
362362
if (sortAndFormats == null) {
363-
// See please https://github.com/apache/lucene/pull/450, should be fixed in 9.x
364363
if (searchAfter != null) {
365-
return TopScoreDocCollector.createSharedManager(
366-
numHits,
367-
new FieldDoc(searchAfter.doc, searchAfter.score),
368-
hitCountThreshold
369-
);
364+
return TopScoreDocCollector.createSharedManager(numHits, searchAfter, hitCountThreshold);
370365
} else {
371366
return TopScoreDocCollector.createSharedManager(numHits, null, hitCountThreshold);
372367
}

0 commit comments

Comments
 (0)