Vector Store: Provide distance functions as scalar functions #15835
Labels
feature: sql: scalars
needs concrete use-case
needs upvotes
Please use the reaction feature on the issue to signal your interest. This helps us prioritize
Problem Statement
Some applications use distance between vectors to get nearest neighbours.
pg_vector example suggests to use Euclidean distance (<-> operator, see operators) to get nearest neighbours.
In general, computing distance between vectors is a valid use case (similarity case aside) and would avoid UDF-function workaround.
See also: https://surrealdb.com/blog/whats-new-for-developers-in-surrealdb-beta-10, https://github.com/pgvector/pgvector?tab=readme-ov-file#vector-functions
Some applications require similarity score (value between [0-1]). This is tracked in #14801
Possible Solutions
Expose scalar functions for different types of distances (euclidean, manhattan, cosine...)
Considered Alternatives
The text was updated successfully, but these errors were encountered: