by alexgarcia-xyz · 2y ago · 0 comments
SELECT
rowid,
distance
FROM vec_items
WHERE rowid IN (SELECT rowid FROM ...)
AND title_embeddings MATCH ?
ORDER BY distance
LIMIT 10
^ This would do a KNN style query, k=10, but only include results where the item's rowid is included in the (...) subquery. This is a half-measure for metadata filtering, by pre-filtering which items should be considered in the KNN search.It's currently a bit slow, and not the best solution. Eventually there will be support for metadata column in vec0 tables, which with trickery should be much faster, but isn't planned for v0.1.0.