Open
Description
Given the following Table:
CREATE TABLE killrvideo.videos (
videoid uuid PRIMARY KEY,
added_date timestamp,
description text,
location text,
location_type int,
name text,
preview_image_location text,
tags set<text>,
userid uuid,
video_vector vector<float, 384>
);
CREATE CUSTOM INDEX video_stemming_idx ON killrvideo.videos (description) USING 'StorageAttachedIndex' WITH OPTIONS = {'index_analyzer': '{
"tokenizer":{"name": "standard"},
"filters" : [{"name":"porterstem"}]}'};
CREATE CUSTOM INDEX video_vector_idx ON killrvideo.videos (video_vector) USING 'StorageAttachedIndex';
CREATE CUSTOM INDEX videos_tag ON killrvideo.videos (values(tags)) USING 'StorageAttachedIndex';
When implement a find with
public List<VideoTableEntity> findVideosByVector(DataAPIVector vector) {
return videosRepository.find(null, new TableFindOptions()
.sort(Sort.vector("video_vector", vector)))
.includeSimilarity()
.limit(10)
.toList();
}
and entity
@EntityTable("videos")
public class VideoTableEntity {
@PartitionBy(0)
@Column(name="videoid")
private UUID videoId;
@Column(name="added_date")
private Instant addedDate;
private String description;
private String location;
@Column(name="location_type")
private String locationType;
private String name;
@Column(name="preview_image_location")
private String previewImageLocation;
@Column(name="solr_query")
private String solrQuery;
private Set<String> tags;
@Column(name="user_id")
private UUID userId;
@Column(name="video_vector", type = ColumnTypes.VECTOR)
private DataAPIVector videoVector;
An error is returned:
at com.datastax.astra.client.tables.cursor.TableFindCursor.includeSimilarity(TableFindCursor.java:189) ~[astra-db-java-2.0.0.jar:na]
at com.datastax.astra.client.tables.cursor.TableFindCursor.includeSimilarity(TableFindCursor.java:189) ~[astra-db-java-2.0.0.jar:na]
at com.datastax.astra.client.tables.cursor.TableFindCursor.includeSimilarity(TableFindCursor.java:189) ~[astra-db-java-2.0.0.jar:na]
Ok, so if I get rid of .includeSimilarity()
, I see the same thing, except the code breaks at a different spot:
at com.datastax.astra.client.tables.cursor.TableFindCursor.limit(TableFindCursor.java:164) ~[astra-db-java-2.0.0.jar:na]
And like before, there's a massive number of those.
It's almost like it's having a hard time processing my TableFIndOptions.
Ha! Works! Changed my API method call to:
public List<VideoTableEntity> findVideosByVector(DataAPIVector vector) {
return videosRepository.find(null, new TableFindOptions()
.sort(Sort.vector("video_vector", vector))
.limit(10))
.toList();
}