vectorstore = QdrantVectorStore.from_documents(
[],
url=os.getenv("QDRANT_ENDPOINT"),
api_key=os.getenv("QDRANT_API_KEY"),
prefer_grpc=True,
collection_name=COLLECTION_NAME,
embedding=embedding,
content_payload_key="page_content",
metadata_payload_key="metadata",
)
# document
doc = Document(page_content="For fever and pain relief", metadata={
"question": "What are the usage of paracetamol",
"source": "QnA",
"category": "QnA",
"last_modified": "2025-07-27T17:18:00.115384+00:00",
"doc_id": "QA-1130"
} )
vectorstore.add_documents([doc])
test_docs = vectorstore.similarity_search(
"test",
k=1,
filter=models.Filter(
must=[
models.FieldCondition(
key="metadata.source",
match=models.MatchText(text="QnA")
)
]
)
)
I am a beginner in langchain and qdrant and II’m attempting to create an index for metadata in my Qdrant Cloud collection so I can do filtered searches, but I keep running into the same frustrating issue - my test_docs
results always come back empty, no matter what I try.
So far, I’ve experimented with:
- Using
QdrantVectorStore
directly - Trying
QdrantVectorStore.from_documents()
- Testing both with and without the
metadata_payload_key
parameter
I have already struggled in this problem for several days, I will be very grateful for your help!