From: lambda-science (@lambda-science) <noreply+lambda-science@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #259: Understanding HNSW + filtering
Date: Tue, 05 Mar 2024 13:12:37 +0000
Message-ID: <gh-pgvector-pgvector-259-c1978750275@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-259@github.com>
References: <gh-pgvector-pgvector-259@github.com>
Is there any news about this 👀 I wish to use PGVector as Vector database but filters are crucials for my use-case.
Maybe a good example of such filter could be taken from OpenSearch efficient filtering ?
https://opensearch.org/docs/latest/search-plugins/knn/filter-search-knn/#using-a-faiss-efficient-fil...
It's basically what has been proposed here
- Pre-filter, if after filter the number of doc (P) is under a set treshold (FT, for example 50 000 docs): do bruteforce search
- If not, do approximate search with HNSW index over all doc but only add doc matching filter to the results (R, post-filtering)
- If resulting docs (R) >K # Good, it worked !
- Elif resulting docs (R) <K # Perform brutefoce search on docs pre-filtered - last resort ; very expensive
It's a mix of pre-filter, post-filter and smart choice between approximate search and brute-force search.
