Apache Lucene open-source search software
Edit HNSW API docs (#13688)
pierwill054295fd380a
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsFormat.javaindex 25f9e17eadd..04ad32d8aa9 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsFormat.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsFormat.java@@ -51,9 +51,9 @@ import org.apache.lucene.util.hnsw.HnswGraphBuilder;* <li><b>array[vint]</b> the delta encoded neighbor ordinals* </ul>* </ul>- * <li>After all levels are encoded memory offsets for each node's neighbor nodes encoded by- * {@link org.apache.lucene.util.packed.DirectMonotonicWriter} are appended to the end of the- * file.+ * <li>After all levels are encoded, memory offsets for each node's neighbor nodes are appended to+ * the end of the file. The offsets are encoded by {@link+ * org.apache.lucene.util.packed.DirectMonotonicWriter}.* </ul>** <h2>.vem (vector metadata) file</h2>@@ -101,9 +101,9 @@ public final class Lucene99HnswVectorsFormat extends KnnVectorsFormat {public static final int DEFAULT_MAX_CONN = HnswGraphBuilder.DEFAULT_MAX_CONN;/**- * The maximum size of the queue to maintain while searching during graph construction This- * maximum value preserves the ratio of the DEFAULT_BEAM_WIDTH/DEFAULT_MAX_CONN i.e. `6.25 * 16 =- * 3200`+ * The maximum size of the queue to maintain while searching during graph construction. This+ * maximum value preserves the ratio of the `DEFAULT_BEAM_WIDTH`/`DEFAULT_MAX_CONN` (i.e. `6.25 *+ * 16 = 3200`).*/public static final int MAXIMUM_BEAM_WIDTH = 3200;@@ -130,7 +130,7 @@ public final class Lucene99HnswVectorsFormat extends KnnVectorsFormat {*/private final int beamWidth;- /** The format for storing, reading, merging vectors on disk */+ /** The format for storing, reading, and merging vectors on disk. */private static final FlatVectorsFormat flatVectorsFormat =new Lucene99FlatVectorsFormat(FlatVectorScorerUtil.getLucene99FlatVectorsScorer());diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraph.java b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraph.javaindex ba0b714fdd7..0c38c4e2ff7 100644--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraph.java+++ b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraph.java@@ -68,7 +68,7 @@ public abstract class HnswGraph {/** Returns the number of nodes in the graph */public abstract int size();- /** Returns max node id, inclusive, normally this value will be size - 1 */+ /** Returns max node id, inclusive. Normally this value will be size - 1. */public int maxNodeId() {return size() - 1;}@@ -130,7 +130,7 @@ public abstract class HnswGraph {};/**- * Iterator over the graph nodes on a certain level, Iterator also provides the size – the total+ * Iterator over the graph nodes on a certain level. Iterator also provides the size – the total* number of nodes to be iterated over. The nodes are NOT guaranteed to be presented in any* particular order.*/diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswUtil.java b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswUtil.javaindex bea4a6031ad..a4b1d0c7c53 100644--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswUtil.java+++ b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswUtil.java@@ -67,8 +67,8 @@ public class HnswUtil {/*** Returns the sizes of the distinct graph components on the given level. The forest starting at* the entry points (nodes in the next highest level) is considered as a single component. If the- * entire graph is rooted in the entry points, that is every node is reachable from at least one- * entry point, the returned list will have a single entry. If the graph is empty, the returned+ * entire graph is rooted in the entry points--that is, every node is reachable from at least one+ * entry point--the returned list will have a single entry. If the graph is empty, the returned* list will be empty.*/static List<Integer> componentSizes(HnswGraph hnsw, int level) throws IOException {