mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-29 07:58:31 +02:00
docs: Query API snippets with Python (#1095)
Co-authored-by: generall <andrey@vasnetsov.com>
This commit is contained in:
@@ -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
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user