Skip to content

Commit 282b166

Browse files
author
Michael Sokolov
committed
fix lucene91 back-compat test failure; add CHANGES entry
1 parent f0027e2 commit 282b166

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

lucene/CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ Improvements
184184

185185
* GITHUB#15332: Add PhraseQuery.Builder.setMaxTerms() method to limit the maximum number of terms and excessive memory use (linyunanit)
186186

187+
* GITHUB#15425: Refactoring internal HnswGraph.NodesIterator to avoid unneeded copying and sorting (Mike Sokolov)
188+
187189
Optimizations
188190
---------------------
189191
* GITHUB#15140: Optimize TopScoreDocCollector with TernaryLongHeap for improved performance over Binary-LongHeap. (Ramakrishna Chilaka)

lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91/Lucene91OnHeapHnswGraph.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public NodesIterator getNodesOnLevel(int level) {
175175
if (level == 0) {
176176
return new DenseNodesIterator(size());
177177
} else {
178-
return new ArrayNodesIterator(nodesByLevel.get(level));
178+
return new ArrayNodesIterator(nodesByLevel.get(level), graph.get(level).size());
179179
}
180180
}
181181
}

lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsWriter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import org.apache.lucene.index.MergeState;
4646
import org.apache.lucene.index.SegmentWriteState;
4747
import org.apache.lucene.index.Sorter;
48-
import org.apache.lucene.index.VectorEncoding;
4948
import org.apache.lucene.index.VectorSimilarityFunction;
5049
import org.apache.lucene.search.TaskExecutor;
5150
import org.apache.lucene.store.IndexOutput;
@@ -61,7 +60,6 @@
6160
import org.apache.lucene.util.hnsw.IncrementalHnswGraphMerger;
6261
import org.apache.lucene.util.hnsw.NeighborArray;
6362
import org.apache.lucene.util.hnsw.OnHeapHnswGraph;
64-
import org.apache.lucene.util.hnsw.UpdateableRandomVectorScorer;
6563
import org.apache.lucene.util.hnsw.RandomVectorScorerSupplier;
6664
import org.apache.lucene.util.packed.DirectMonotonicWriter;
6765

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,14 @@ public static class ArrayNodesIterator extends NodesIterator {
191191
private final int[] nodes;
192192
private int cur = 0;
193193

194-
/** Sole constructor */
194+
/** Normal constructor */
195195
public ArrayNodesIterator(int[] nodes) {
196-
super(nodes.length);
196+
this(nodes, nodes.length);
197+
}
198+
199+
/** Constructor that allows overriding size, used only for back-compat */
200+
public ArrayNodesIterator(int[] nodes, int size) {
201+
super(size);
197202
this.nodes = nodes;
198203
}
199204

0 commit comments

Comments
 (0)