Skip to content

Commit a80c3fb

Browse files
committed
comment fixes
1 parent 2401c62 commit a80c3fb

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ public final class Lucene99HnswVectorsReader extends KnnVectorsReader
7373

7474
private static final long SHALLOW_SIZE =
7575
RamUsageEstimator.shallowSizeOfInstance(Lucene99HnswVectorsFormat.class);
76-
// Number of ordinals to score at a time when scoring exhaustively rather than
77-
// using HNSW.
76+
// Number of ordinals to score at a time when scoring exhaustively rather than using HNSW.
7877
private static final int EXHAUSTIVE_BULK_SCORE_ORDS = 64;
7978

8079
private final FlatVectorsReader flatVectorsReader;
@@ -341,8 +340,8 @@ private void search(
341340
// The approximate number of vectors that would be visited if we did not filter
342341
int unfilteredVisit = HnswGraphSearcher.expectedVisitedNodes(knnCollector.k(), graph.size());
343342
if (acceptDocs instanceof BitSet bitSet) {
344-
// Use approximate cardinality as this is good enough, but ensure we don't
345-
// exceed the graph size as that is illogical
343+
// Use approximate cardinality as this is good enough, but ensure we don't exceed the graph
344+
// size as that is illogical
346345
filteredDocCount = Math.min(bitSet.approximateCardinality(), graph.size());
347346
if (unfilteredVisit >= filteredDocCount) {
348347
doHnsw = false;
@@ -352,8 +351,8 @@ private void search(
352351
HnswGraphSearcher.search(
353352
scorer, collector, getGraph(fieldEntry), acceptedOrds, filteredDocCount);
354353
} else {
355-
// if k is larger than the number of vectors we expect to visit in an HNSW
356-
// search, we can just iterate over all vectors and collect them.
354+
// if k is larger than the number of vectors we expect to visit in an HNSW search,
355+
// we can just iterate over all vectors and collect them.
357356
int[] ords = new int[EXHAUSTIVE_BULK_SCORE_ORDS];
358357
float[] scores = new float[EXHAUSTIVE_BULK_SCORE_ORDS];
359358
int numOrds = 0;
@@ -443,8 +442,7 @@ private record FieldEntry(
443442
int dimension,
444443
int size,
445444
int[][] nodesByLevel,
446-
// for each level the start offsets in vectorIndex file from where to read
447-
// neighbours
445+
// for each level the start offsets in vectorIndex file from where to read neighbours
448446
DirectMonotonicReader.Meta offsetsMeta,
449447
long offsetsOffset,
450448
int offsetsBlockShift,

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,10 @@ void searchLevel(
300300
}
301301
}
302302

303-
// A bound that holds the minimum similarity to the query vector that a
304-
// candidate vector must
303+
// A bound that holds the minimum similarity to the query vector that a candidate vector must
305304
// have to be considered.
306305
float minAcceptedSimilarity = Math.nextUp(results.minCompetitiveSimilarity());
307-
// We should allow exploring equivalent minAcceptedSimilarity values at least
308-
// once
306+
// We should allow exploring equivalent minAcceptedSimilarity values at least once
309307
boolean shouldExploreMinSim = true;
310308
while (candidates.size() > 0 && results.earlyTerminated() == false) {
311309
// get the best candidate (closest or best scoring)
@@ -354,8 +352,7 @@ void searchLevel(
354352
float oldMinAcceptedSimilarity = minAcceptedSimilarity;
355353
minAcceptedSimilarity = Math.nextUp(results.minCompetitiveSimilarity());
356354
if (minAcceptedSimilarity > oldMinAcceptedSimilarity) {
357-
// we adjusted our minAcceptedSimilarity, so we should explore the next
358-
// equivalent
355+
// we adjusted our minAcceptedSimilarity, so we should explore the next equivalent
359356
// if necessary
360357
shouldExploreMinSim = true;
361358
}

0 commit comments

Comments
 (0)