couchbase-lite-core icon indicating copy to clipboard operation
couchbase-lite-core copied to clipboard

Support latest vectorsearch (dev branch) and hybrid queries

Open snej opened this issue 1 year ago • 1 comments

  1. Added the official SQLite carray extension, because the latest vectorsearch library requires it.
  2. Support for hybrid vector queries, where the vector search is combined with other criteria on the collection:
  • When vector_match() is the only criterion in the WHERE clause, OR if an explicit max_results arg is given, it's a "plain" query like already existed.
  • Otherwise it's a "hybrid" query, which invokes the vectorsearch extension differently (with a JOIN constraint on its rowid column.) This is less efficient, but computes distances for all the rows selected by the other WHERE tests, instead of just finding the closest docs in the whole collection, so it gives more accurate results.
  1. In a plain query where there is no max_results given, but the query itself has a LIMIT, use the LIMIT as the max_results for the vector query. This is intuitive, and makes it so you only need to use max_results if you want to force a plain vector query in combination with other conditions.

snej avatar Mar 14 '24 18:03 snej

@snej Can you fix the windows build issue so the PR could get reviewed?

pasin avatar Apr 23 '24 18:04 pasin