Skip to content

Commit 93bac68

Browse files
committed
add test for vector search in ATTACHED db
1 parent e853d54 commit 93bac68

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

libsql-sqlite3/test/libsql_vector_index.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,3 +508,24 @@ do_test vector-errors {
508508
{vector index(search): third parameter (k) must be an integer, but float value were provided}
509509
{vector index(insert): dimensions are different: 1 != 3}
510510
}]
511+
512+
513+
do_test vector-index-attach-setup {
514+
forcedelete test2.db
515+
forcedelete test2.db-journal
516+
sqlite3 db2 test2.db
517+
518+
execsql {
519+
CREATE TABLE t_attach(e FLOAT32(3));
520+
CREATE INDEX t_attach_idx ON t_attach(libsql_vector_idx(e));
521+
INSERT INTO t_attach VALUES (vector('[1,2,3]'));
522+
INSERT INTO t_attach VALUES (vector('[2,3,4]'));
523+
INSERT INTO t_attach VALUES (vector('[3,4,5]'));
524+
INSERT INTO t_attach VALUES (vector('[4,5,6]'));
525+
} db2
526+
} {}
527+
528+
do_execsql_test vector-index-attach-query {
529+
ATTACH DATABASE 'test2.db' AS t;
530+
SELECT * FROM vector_top_k('t.t_attach_idx', vector('[3,4,5]'), 4);
531+
} {3 4 2 1}

0 commit comments

Comments
 (0)