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

Last-minute changes to vector search SQL++ syntax

Open snej opened this issue 1 year ago • 1 comments

As per recent meetings & email threads, for Server SQL++ compatibility.

  • There is no more VECTOR_MATCH function.
  • VECTOR_DISTANCE renamed to APPROX_VECTOR_DIST.
    • Parameters are (vector expression, target vector, [metric], [nprobes]); last two optional.
    • metric, if given, is a case-insensitive string that must match the index's metric. Current supported values are "EUCLIDEAN_SQUARED", "L2_SQUARED", "COSINE".
    • nprobes, if given, overrides the value specified when the index was created.
  • A non-hybrid vector query must have a LIMIT clause. There is no more default limit.
  • A hybrid query is one with a WHERE clause (and a APPROX_VECTOR_DIST call, of course.)
  • Two new metrics in the API: kC4VectorMetricEuclidean1 and kC4VectorMetricDot.
    • I renamed kC4VectorMetricEuclidean to kC4VectorMetricEuclidean2 to avoid ambiguity.
    • Using the new metrics at runtime requires an updated vector-search extension; see https://github.com/couchbaselabs/mobile-vector-search/pull/69
    • Their SQL++ names are "EUCLIDEAN" (AKA "L2") and "DOT".

snej avatar Jul 03 '24 21:07 snej