Expand description
Rewrite SEARCH <coll> USING VECTOR(<field>, ARRAY[...], <k>) to the
canonical SELECT * FROM <coll> ORDER BY vector_distance(<field>, ARRAY[...]) LIMIT <k>.
<field> may be omitted (and the third arg becomes the limit). When the
collection has a single declared vector column the planner resolves the
field; otherwise vector_distance rejects the call with a typed error.
The same clause is also accepted in subquery position — FROM (SEARCH ...) s, IN (SELECT id FROM (SEARCH ...) s) — so a k-NN result composes with
joins and relational filters inside one statement.
Functions§
- try_
rewrite_ nested_ search_ using_ vector - Rewrite every
(SEARCH <coll> USING VECTOR(...))occurrence that sits in subquery position into(SELECT ...), leaving the rest ofsqluntouched. - try_
rewrite_ search_ using_ vector