File tree Expand file tree Collapse file tree 4 files changed +10
-5
lines changed
backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene91
core/src/java/org/apache/lucene Expand file tree Collapse file tree 4 files changed +10
-5
lines changed Original file line number Diff line number Diff 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+
187189Optimizations
188190---------------------
189191* GITHUB#15140: Optimize TopScoreDocCollector with TernaryLongHeap for improved performance over Binary-LongHeap. (Ramakrishna Chilaka)
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change 4545import org .apache .lucene .index .MergeState ;
4646import org .apache .lucene .index .SegmentWriteState ;
4747import org .apache .lucene .index .Sorter ;
48- import org .apache .lucene .index .VectorEncoding ;
4948import org .apache .lucene .index .VectorSimilarityFunction ;
5049import org .apache .lucene .search .TaskExecutor ;
5150import org .apache .lucene .store .IndexOutput ;
6160import org .apache .lucene .util .hnsw .IncrementalHnswGraphMerger ;
6261import org .apache .lucene .util .hnsw .NeighborArray ;
6362import org .apache .lucene .util .hnsw .OnHeapHnswGraph ;
64- import org .apache .lucene .util .hnsw .UpdateableRandomVectorScorer ;
6563import org .apache .lucene .util .hnsw .RandomVectorScorerSupplier ;
6664import org .apache .lucene .util .packed .DirectMonotonicWriter ;
6765
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments