Package com.dtsx.astra.sdk.cassio
Class MetadataVectorTable
java.lang.Object
com.dtsx.astra.sdk.cassio.AbstractCassandraTable<MetadataVectorRecord>
com.dtsx.astra.sdk.cassio.MetadataVectorTable
Table representing persistence for Vector Stores support. As the name stated
it holds both a vector and a metadata map.
CREATE TABLE langchain4j.test_embedding_store (
row_id text PRIMARY KEY,
attributes_blob text,
body_blob text,
metadata_s map<text, text>,
vector vector<float, 11>
);
-
Field Summary
Fields inherited from class com.dtsx.astra.sdk.cassio.AbstractCassandraTable
ATTRIBUTES_BLOB, BODY_BLOB, COLUMN_SIMILARITY, cqlSession, DEFAULT_RECORD_COUNT, keyspaceName, METADATA_S, PARTITION_ID, ROW_ID, SAI_INDEX_CLASSNAME, tableName, VECTOR -
Constructor Summary
ConstructorsConstructorDescriptionMetadataVectorTable(com.datastax.oss.driver.api.core.CqlSession session, String keyspaceName, String tableName, int vectorDimension) Constructor with mandatory parameters.MetadataVectorTable(com.datastax.oss.driver.api.core.CqlSession session, String keyspaceName, String tableName, int vectorDimension, CassandraSimilarityMetric metric) Constructor with mandatory parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate()Create table and indexes if not exist.mapRow(com.datastax.oss.driver.api.core.cql.Row cqlRow) Should be table to map from a Cassandra row to a record.voidput(MetadataVectorRecord row) Upsert a row of the table.similaritySearch(AnnQuery query) Compute Similarity Search.Methods inherited from class com.dtsx.astra.sdk.cassio.AbstractCassandraTable
clear, delete, getCqlSession, putAsync
-
Constructor Details
-
MetadataVectorTable
public MetadataVectorTable(com.datastax.oss.driver.api.core.CqlSession session, String keyspaceName, String tableName, int vectorDimension) Constructor with mandatory parameters.- Parameters:
session- cassandra sessionkeyspaceName- keyspace nametableName- table namevectorDimension- vector dimension
-
MetadataVectorTable
public MetadataVectorTable(com.datastax.oss.driver.api.core.CqlSession session, String keyspaceName, String tableName, int vectorDimension, CassandraSimilarityMetric metric) Constructor with mandatory parameters.- Parameters:
session- cassandra sessionkeyspaceName- keyspace nametableName- table namevectorDimension- vector dimensionmetric- similarity metric
-
-
Method Details
-
create
public void create()Create table and indexes if not exist.- Specified by:
createin classAbstractCassandraTable<MetadataVectorRecord>
-
put
Upsert a row of the table.- Specified by:
putin classAbstractCassandraTable<MetadataVectorRecord>- Parameters:
row- current row
-
mapRow
Description copied from class:AbstractCassandraTableShould be table to map from a Cassandra row to a record.- Specified by:
mapRowin classAbstractCassandraTable<MetadataVectorRecord>- Parameters:
cqlRow- current cassandra row- Returns:
- current record
-
similaritySearch
Compute Similarity Search.- Parameters:
query- current query- Returns:
- results
-