You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2022/01/27 20:28:21 UTC
[lucene] branch branch_9x updated: LUCENE-10384: Simplify LongHeap small addition (#623)
This is an automated email from the ASF dual-hosted git repository.
mayya pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new f561403 LUCENE-10384: Simplify LongHeap small addition (#623)
f561403 is described below
commit f56140335a0cdb3bff2e5eeb6ff0e3c5bafc3666
Author: Mayya Sharipova <ma...@elastic.co>
AuthorDate: Tue Jan 25 11:43:40 2022 -0500
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.
---
lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java | 2 +-
lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java b/lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java
index 83a8b75..0d2b94d 100644
--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java
+++ b/lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java
@@ -100,7 +100,7 @@ public class NeighborQueue {
int size = size();
int[] nodes = new int[size];
for (int i = 0; i < size; i++) {
- nodes[i] = (int) heap.get(i + 1);
+ nodes[i] = (int) order.apply(heap.get(i + 1));
}
return nodes;
}
diff --git a/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java b/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java
index 306c562..38bb50a 100644
--- a/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java
+++ b/lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java
@@ -201,7 +201,7 @@ public class TestHnswGraph extends LuceneTestCase {
CircularVectorValues vectors = new CircularVectorValues(nDoc);
HnswGraphBuilder builder =
new HnswGraphBuilder(
- vectors, VectorSimilarityFunction.DOT_PRODUCT, 16, 100, random().nextInt());
+ vectors, VectorSimilarityFunction.EUCLIDEAN, 16, 100, random().nextInt());
HnswGraph hnsw = builder.build(vectors);
// Skip over half of the documents that are closest to the query vector
@@ -215,7 +215,7 @@ public class TestHnswGraph extends LuceneTestCase {
10,
10,
vectors.randomAccess(),
- VectorSimilarityFunction.DOT_PRODUCT,
+ VectorSimilarityFunction.EUCLIDEAN,
hnsw,
acceptOrds,
new SplittableRandom(random().nextLong()));