Class OnHeapGraph<T>
java.lang.Object
org.apache.cassandra.index.sai.disk.v1.vector.OnHeapGraph<T>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionOnHeapGraph(AbstractType<?> termComparator, IndexWriterConfig indexWriterConfig, Memtable memtable) -
Method Summary
Modifier and TypeMethodDescriptionlongadd(ByteBuffer term, T key, OnHeapGraph.InvalidVectorBehavior behavior) static voidcheckInBounds(float[] v) booleanisEmpty()keysFromOrdinal(int node) longremove(ByteBuffer term, T key) CloseableIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>search(float[] queryVector, int limit, io.github.jbellis.jvector.util.Bits toAccept) intsize()static voidvalidateIndexable(float[] vector, io.github.jbellis.jvector.vector.VectorSimilarityFunction similarityFunction) float[]vectorForKey(T key) writeData(IndexDescriptor indexDescriptor, IndexIdentifier indexIdentifier, Function<T, Integer> postingTransformer)
-
Field Details
-
MIN_PQ_ROWS
public static final int MIN_PQ_ROWS- See Also:
-
MAX_FLOAT32_COMPONENT
public static final float MAX_FLOAT32_COMPONENT- See Also:
-
-
Constructor Details
-
OnHeapGraph
public OnHeapGraph(AbstractType<?> termComparator, IndexWriterConfig indexWriterConfig, Memtable memtable) - Parameters:
termComparator- the vector typeindexWriterConfig- theIndexWriterConfigfor the graphmemtable- should be provided if attached to a memtable, null otherwise (i.e. compaction). Allows us to configure concurrent search and provide more meaningful trace logging. Concurrent search while building the graph; non-concurrent allows us to avoid synchronization costs.
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
add
- Returns:
- the incremental bytes ysed by adding the given vector to the index
-
checkInBounds
public static void checkInBounds(float[] v) -
validateIndexable
public static void validateIndexable(float[] vector, io.github.jbellis.jvector.vector.VectorSimilarityFunction similarityFunction) -
keysFromOrdinal
-
vectorForKey
-
remove
-
search
public CloseableIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore> search(float[] queryVector, int limit, io.github.jbellis.jvector.util.Bits toAccept) - Returns:
- keys (PrimaryKey or segment row id) associated with the topK vectors near the query
-
writeData
public SegmentMetadata.ComponentMetadataMap writeData(IndexDescriptor indexDescriptor, IndexIdentifier indexIdentifier, Function<T, Integer> postingTransformer) throws IOException- Throws:
IOException
-