Hacker News new | ask | show | jobs
by alexgarcia-xyz 781 days ago
Ya you'll be able to do things like:

  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.

1 comments

Nice. So if I understand correctly, pre-filtering means we'd get 10 results here if there are at least 10 returned from the subquery?