Skip to content

Commit f561403

Browse files
LUCENE-10384: Simplify LongHeap small addition (#623)
LUCENE-10384 and PR#615 introduced encoding f into NeighborQueue. But one function `nodes()` was remained to add this encoding. Also modify the test that would fail without this patch.
1 parent b6fbdcc commit f561403

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ int[] nodes() {
100100
int size = size();
101101
int[] nodes = new int[size];
102102
for (int i = 0; i < size; i++) {
103-
nodes[i] = (int) heap.get(i + 1);
103+
nodes[i] = (int) order.apply(heap.get(i + 1));
104104
}
105105
return nodes;
106106
}

lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public void testSearchWithSkewedAcceptOrds() throws IOException {
201201
CircularVectorValues vectors = new CircularVectorValues(nDoc);
202202
HnswGraphBuilder builder =
203203
new HnswGraphBuilder(
204-
vectors, VectorSimilarityFunction.DOT_PRODUCT, 16, 100, random().nextInt());
204+
vectors, VectorSimilarityFunction.EUCLIDEAN, 16, 100, random().nextInt());
205205
HnswGraph hnsw = builder.build(vectors);
206206

207207
// Skip over half of the documents that are closest to the query vector
@@ -215,7 +215,7 @@ public void testSearchWithSkewedAcceptOrds() throws IOException {
215215
10,
216216
10,
217217
vectors.randomAccess(),
218-
VectorSimilarityFunction.DOT_PRODUCT,
218+
VectorSimilarityFunction.EUCLIDEAN,
219219
hnsw,
220220
acceptOrds,
221221
new SplittableRandom(random().nextLong()));

0 commit comments

Comments
 (0)