Skip to content

Instantly share code, notes, and snippets.

@generall
Last active June 21, 2022 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save generall/383c01994a672424ff59f5fa56cd0c4f to your computer and use it in GitHub Desktop.
Save generall/383c01994a672424ff59f5fa56cd0c4f to your computer and use it in GitHub Desktop.
from qdrant_client.http.models import Filter
...
city_of_interest = "Berlin"
# Define a filter for cities
city_filter = Filter(**{
"must": [{
"key": "city", # We store city information in a field of the same name
"match": { # This condition checks if payload field have requested value
"value": city_of_interest
}
}]
})
search_result = self.qdrant_client.search(
collection_name=self.collection_name,
query_vector=vector,
query_filter=city_filter,
top=5
)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment