docs: Query API snippets with Python (#1095)

Co-authored-by: generall <andrey@vasnetsov.com>
This commit is contained in:
Anush
2024-08-23 22:48:27 +05:30
committed by GitHub
co-authored by generall
parent 4821e18664
commit e9fa9be0a4
17 changed files with 203 additions and 195 deletions
@@ -226,12 +226,12 @@ def search(self, text: str):
vector = self.model.encode(text).tolist()
# Use `vector` for search for closest vectors in the collection
search_result = self.qdrant_client.search(
search_result = self.qdrant_client.query_points(
collection_name=self.collection_name,
query_vector=vector,
query=vector,
query_filter=None, # If you don't want any filters for now
limit=5, # 5 the most closest results is enough
)
).points
# `search_result` contains found vector ids with similarity scores along with the stored payload
# In this function you are interested in payload only
payloads = [hit.payload for hit in search_result]
@@ -260,12 +260,12 @@ from qdrant_client.models import Filter
}]
})
search_result = self.qdrant_client.search(
search_result = self.qdrant_client.query_points(
collection_name=self.collection_name,
query_vector=vector,
query=vector,
query_filter=city_filter,
limit=5
)
).points
...
```