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

feat: Support get non-zero indices for inverted index #10

Open
VoVAllen opened this issue Jun 4, 2024 · 0 comments
Open

feat: Support get non-zero indices for inverted index #10

VoVAllen opened this issue Jun 4, 2024 · 0 comments

Comments

@VoVAllen
Copy link
Member

VoVAllen commented Jun 4, 2024

An simple solution for BM25 indexing is to get all intersected documents through inverted index and than calculate score in a brute force way.

CREATE INDEX on document USING GIN(to_voc_ids(sparsevec) gin__int_ops)

# Then utilize GIN index to query
SELECT pid FROM documents WHERE to_voc_ids(documents.embedding) && to_voc_ids(queries.embedding)
    ORDER BY queries.embedding <#> documents.embedding LIMIT 1

Probably should skip stop word index in to_voc_ids

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