Retrieve queries based on metadata in a Qdrant database #5594
Replies: 1 comment 7 replies
-
I'm not exactly sure what your approach is like, because your example does not make that very clear. If you're using payload values to isolate searches, that should already be sufficient. If it is problematic somehow I expect there to be a bug in the implementation. If you're embedding your query and are searching using vector similarity, results can be approximate. For example, if there are no close matches to your search query, it'll simply return the closest match it can find even if it's completely unrelated material.
You can isolate data by specifying a payload value that is unique across users. Please make sure you configure a payload index for this, as it'll help to keep searches fast and to keep good search accuracy. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am working on a RAG-based LLM agent. Here, I am storing multiple user details and document details in a single collection, organized based on user_id and agent_id. I am writing a search approach to retrieve information from the database based on these IDs. However, I am facing an issue where the results return information even if the specified information is not in the document. Additionally, how can I isolate data when the same files are stored for different users?
''' query = "Bullying"
query_vector = get_embedding(query)
Search with a filter to match only documents containing "Qdrant"
results = client.search(
collection_name='test',
query_vector=query_vector,
limit=1,
query_filter={
"must": [
{"key": "user_id", "match": {"value": "K5617"}},
{"key": "agent_id", "match": {"value": "5307"}},
]
}
)
Check if results contain any data
if results:
for result in results:
print(f"Document ID: {result.id}, Score: {result.score}")
print(f"Text: {result.payload['text']}\n")
else:
print("Information not available")'''
Beta Was this translation helpful? Give feedback.
All reactions