Edit HNSW API docs (#13688)

* Edit HNSW API docs for clarity, readability, punctuation, etc.

Co-authored-by: pierwill <pierwill@users.noreply.github.com>
This commit is contained in:
pierwill 2024-08-26 13:17:59 -05:00 committed by GitHub
parent 3e3a7db1db
commit 054295fd38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 11 deletions

View File

@ -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());

View File

@ -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.
*/

View File

@ -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 {