You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,14 +94,14 @@ CREATE INDEX documents_embedding_bm25 ON documents USING bm25 (embedding bm25_op
94
94
Now we can calculate the BM25 score between the query and the vectors. Note that the BM25 score in VectorChord-BM25 is negative, which means the more negative the score, the more relevant the document is. We intentionally make it negative so that you can use the default order by to get the most relevant documents first.
95
95
96
96
```sql
97
-
--to_bm25query(index_name, query, tokenizer_name)
97
+
--bm25query(index_name, query, tokenizer_name)
98
98
-- <&> is the operator to compute the bm25 score
99
-
SELECT id, passage, embedding <&>to_bm25query('documents_embedding_bm25', tokenize('PostgreSQL', 'bert')) AS bm25_score FROM documents;
99
+
SELECT id, passage, embedding <&>bm25query('documents_embedding_bm25', tokenize('PostgreSQL', 'bert')) AS bm25_score FROM documents;
100
100
```
101
101
102
102
And you can use the order by to utilize the index to get the most relevant documents first and faster.
103
103
```sql
104
-
SELECT id, passage, embedding <&>to_bm25query('documents_embedding_bm25', tokenize('PostgreSQL', 'bert')) AS rank
104
+
SELECT id, passage, embedding <&>bm25query('documents_embedding_bm25', tokenize('PostgreSQL', 'bert')) AS rank
105
105
FROM documents
106
106
ORDER BY rank
107
107
LIMIT10;
@@ -163,7 +163,7 @@ INSERT INTO documents (passage) VALUES
163
163
164
164
CREATEINDEXdocuments_embedding_bm25ON documents USING bm25 (embedding bm25_ops);
165
165
166
-
SELECT id, passage, embedding <&>to_bm25query('documents_embedding_bm25', tokenize('PostgreSQL', 'tokenizer1')) AS rank
166
+
SELECT id, passage, embedding <&>bm25query('documents_embedding_bm25', tokenize('PostgreSQL', 'tokenizer1')) AS rank
167
167
FROM documents
168
168
ORDER BY rank
169
169
LIMIT10;
@@ -217,7 +217,7 @@ INSERT INTO documents (passage) VALUES
217
217
218
218
CREATEINDEXdocuments_embedding_bm25ON documents USING bm25 (embedding bm25_ops);
219
219
220
-
SELECT id, passage, embedding <&>to_bm25query('documents_embedding_bm25', tokenize('人', 'tokenizer1')) AS rank
220
+
SELECT id, passage, embedding <&>bm25query('documents_embedding_bm25', tokenize('人', 'tokenizer1')) AS rank
0 commit comments