Metadata based filtering for similarity search (any matches) #3261
NaveenKinnal
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am using FAISS similarity search using metadata filtering option to retrieve the best matching documents.
The legacy way is to retrieve a non-calculated number of documents and filter them manually against the metadata value.
However, I came across the in-built metadata based search option which does this
if filter is not None: filter = { key: [value] if not isinstance(value, list) else value for key, value in filter.items() } if all(doc.metadata.get(key) in value for key, value in filter.items()): docs.append((doc, scores[0][j])) else: docs.append((doc, scores[0][j]))which matches the document key-value metadata pairs against the input filter key-value pairs and only returns if all the metadata values are matching - (all condition).
I am looking for a feature that can retrieve a document even if there is at least one key-value match - (any condition). Is it possible to develop this?
Beta Was this translation helpful? Give feedback.
All reactions