Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 07:15 AM
Hi. You can apply a filter on any metadata field in the index.
See the "Use filters on queries" section here: How to create and query a vector search index | Databricks on AWS
The JSON filter syntax takes some getting used to but is flexible. Here's a snippet that shows how to do this:
SEARCH_FILTER = {
"language": "English",
"source_types LIKE": "News"
}
# Limit to English News publications
results = vs.similarity_search(
query_text="Articles that discuss GenAI ethics",
filters=SEARCH_FILTER ,
num_results=4
)