PGVector - Retrieving all documents with metadata filter #29985
Replies: 2 comments 8 replies
-
Hey @sunnstix! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this together! Yes, you can perform retrieval with PGVector using just a metadata query without using vector search. The vectorstore supports a variety of filters that can be applied against the metadata fields of the documents. These filters include operators for equality, inequality, comparison, and logical operations, such as For example, you can use a metadata filter to retrieve documents based on specific criteria without relying on vector similarity: results = vector_store.similarity_search(
"", k=10, filter={"id": {"$eq": "file_b"}}
)
for doc in results:
print(f"* {doc.page_content} [{doc.metadata}]") In this example, the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
Beta Was this translation helpful? Give feedback.
-
@dosu Your answer about using an empty string was incorrect. Are there any other ways to retrieves all documents matching a metadata filter using PGVector? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am building a service where I follow along with traditional use cases of PGVector including population of the database using
vector_store.add_documents
and common retrieval methods includingvector_store.similarity_search
. However, my application also requires me to be able to retrieve all of the documents in the vectorstore annotated with particular metadata and I cannot find documentation on how to perform retrieval without using some form of vector search.Example:
Is there a way to perform retrieval with PGVecttor using just a metadata query?
Beta Was this translation helpful? Give feedback.
All reactions