File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
server/src/main/java/org/elasticsearch/search/vectors Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 3333/**
3434 * A query that matches the provided docs with their scores.
3535 *
36- * Note: this query was adapted from Lucene's DocAndScoreQuery from the class
36+ * Note: this query was originally adapted from Lucene's DocAndScoreQuery from the class
3737 * {@link org.apache.lucene.search.KnnFloatVectorQuery}, which is package-private.
38- * There are no changes to the behavior, just some renames.
3938 */
4039public class KnnScoreDocQuery extends Query {
4140 private final int [] docs ;
@@ -56,6 +55,7 @@ public class KnnScoreDocQuery extends Query {
5655 * @param reader IndexReader
5756 */
5857 KnnScoreDocQuery (ScoreDoc [] scoreDocs , IndexReader reader ) {
58+ // Ensure that the docs are sorted by docId, as they are later searched using binary search
5959 Arrays .sort (scoreDocs , Comparator .comparingInt (scoreDoc -> scoreDoc .doc ));
6060 this .docs = new int [scoreDocs .length ];
6161 this .scores = new float [scoreDocs .length ];
You can’t perform that action at this time.
0 commit comments