From e5b612a8566745b64b7c5c5cccd12b1f6431000b Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sat, 1 Apr 2023 19:34:21 -0700 Subject: [PATCH] Updated readme [skip ci] --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 4940840..1d4ceb4 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,18 @@ DELETE FROM items WHERE id = 1; ## Querying +Get the nearest neighbors to a vector + +```sql +SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5; +``` + +Get the nearest neighbors to another row + +```sql +SELECT * FROM items WHERE id != 1 ORDER BY embedding <-> (SELECT embedding FROM items WHERE id = 1) LIMIT 5; +``` + Use a `SELECT` clause to get the distance ```sql