Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the implementation logic of MATCH in sql #100

Open
Johnly1986 opened this issue Sep 13, 2024 · 1 comment
Open

What is the implementation logic of MATCH in sql #100

Johnly1986 opened this issue Sep 13, 2024 · 1 comment

Comments

@Johnly1986
Copy link

SELECT rowid, distance FROM vec_examples
WHERE sample_embedding MATCH '[0.890, 0.544, 0.825, 0.961, 0.358, 0.0196, 0.521, 0.175]'
order by distance
limit 2;


Hello, What does the SQL statement MATCH do in the above example. Where does distance come from, Does it calculate the Euclidean distance?

@AmgadHasan
Copy link

SELECT rowid, distance FROM vec_examples WHERE sample_embedding MATCH '[0.890, 0.544, 0.825, 0.961, 0.358, 0.0196, 0.521, 0.175]' order by distance limit 2;

Hello, What does the SQL statement MATCH do in the above example. Where does distance come from, Does it calculate the Euclidean distance?

I asked @asg017 over discord and here is the answer:

by default it's L2 distance, can be configured to something else with distance_metric:

create virtual table vec_items using vec0(
   contents_embedding float[768] distance_metric=cosine
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants