Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Efficient HNSW + filtering #51

Open
Palmik opened this issue Sep 11, 2023 · 0 comments
Open

Efficient HNSW + filtering #51

Palmik opened this issue Sep 11, 2023 · 0 comments

Comments

@Palmik
Copy link

Palmik commented Sep 11, 2023

Is there any plan to implement efficient HNSW based ANN with filtering? Imagine you have a table:

CREATE TABLE document (
  id UUID PRIMARY KEY,
  text TEXT NOT NULL,
  embedding REAL[] NOT NULL,
  category TEXT NOT NULL
)

And then you want to do a query like:

SELECT id, text
FROM document
WHERE category = $1
ORDER BY embedding <-> $2
LIMIT 10;

To do this efficiently is not straightforward and will likely need some work, see e.g.: https://qdrant.tech/articles/filtrable-hnsw/
(In this scenario, you could probably achieve similar effect by partitioning the table -- but that's not possible for more complex filters)

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

No branches or pull requests

1 participant