Skip to content

Commit eb71e3e

Browse files
gaobinlongtandonks
authored andcommitted
Use ScoreDoc instead of FieldDoc when creating TopScoreDocCollectorManager to avoid unnecessary conversion (opensearch-project#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]>
1 parent f53d98a commit eb71e3e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8282
- Field-level ignore_malformed should override index-level setting ([#18706](https://github.com/opensearch-project/OpenSearch/pull/18706))
8383
- Fixed Staggered merge - load average replace with AverageTrackers, some Default thresholds modified ([#18666](https://github.com/opensearch-project/OpenSearch/pull/18666))
8484
- Use `new SecureRandom()` to avoid blocking ([18729](https://github.com/opensearch-project/OpenSearch/issues/18729))
85+
- Use ScoreDoc instead of FieldDoc when creating TopScoreDocCollectorManager to avoid unnecessary conversion ([#18802](https://github.com/opensearch-project/OpenSearch/pull/18802))
8586

8687
### Security
8788

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,8 @@ private static TopDocsCollector<?> createCollector(
361361
int hitCountThreshold
362362
) {
363363
if (sortAndFormats == null) {
364-
// See please https://github.com/apache/lucene/pull/450, should be fixed in 9.x
365364
if (searchAfter != null) {
366-
return new TopScoreDocCollectorManager(numHits, new FieldDoc(searchAfter.doc, searchAfter.score), hitCountThreshold);
365+
return new TopScoreDocCollectorManager(numHits, searchAfter, hitCountThreshold);
367366
} else {
368367
return new TopScoreDocCollectorManager(numHits, null, hitCountThreshold);
369368
}

0 commit comments

Comments
 (0)