Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog/122653.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 122653
summary: Knn vector rescoring to sort score docs
area: Vector Search
type: bug
issues:
- 119711
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,6 @@ tests:
- class: org.elasticsearch.xpack.restart.FullClusterRestartIT
method: testWatcherWithApiKey {cluster=UPGRADED}
issue: https://github.com/elastic/elasticsearch/issues/119396
- class: org.elasticsearch.search.profile.dfs.DfsProfilerIT
method: testProfileDfs
issue: https://github.com/elastic/elasticsearch/issues/119711
- class: org.elasticsearch.xpack.security.authc.ldap.ADLdapUserSearchSessionFactoryTests
issue: https://github.com/elastic/elasticsearch/issues/119882
- class: org.elasticsearch.index.mapper.AbstractShapeGeometryFieldMapperTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Objects;

/**
Expand Down Expand Up @@ -60,6 +61,7 @@ public Query rewrite(IndexSearcher searcher) throws IOException {
TopDocs topDocs = searcher.search(query, k);
vectorOperations = topDocs.totalHits.value;
ScoreDoc[] scoreDocs = topDocs.scoreDocs;
Arrays.sort(scoreDocs, Comparator.comparingInt(scoreDoc -> scoreDoc.doc));
int[] docIds = new int[scoreDocs.length];
float[] scores = new float[scoreDocs.length];
for (int i = 0; i < scoreDocs.length; i++) {
Expand Down