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

BM25 ranking with search #636

Open
saeedesmaili opened this issue Aug 3, 2024 · 1 comment
Open

BM25 ranking with search #636

saeedesmaili opened this issue Aug 3, 2024 · 1 comment

Comments

@saeedesmaili
Copy link

What's the recommended way of performing BM25 ranking search with sqlite-utils? I found a mention of rank_bm25() in the docs, but I couldn't figure out how to use the function.

Or maybe I'm misunderstanding the docs, and rank_bm25 is actually what sqlite uses behind the scenes when I use full text search (assuming fts_version="FTS4")?

@saeedesmaili
Copy link
Author

Ok, I dug a bit into sqlite fts5 docs, and apparently it's already using bm25 even in fts5:

... in a full-text query, column rank contains by default the same value as would be returned by executing the bm25() auxiliary function with no trailing arguments. The difference between reading from the rank column and using the bm25() function directly within the query is only significant when sorting by the returned value. In this case, using "rank" is faster than using bm25().

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

1 participant