You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/search/vector-search-filters.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,22 +14,21 @@ ms.date: 08/19/2024
14
14
15
15
# Add a filter in a vector query in Azure AI Search
16
16
17
-
You can define a vector query request that includes a [filter expression](search-filters.md) to add inclusion or exclusion criteria to your queries.
17
+
You can define a vector query request that includes a [filter expression](search-filters.md) to add inclusion or exclusion criteria to your queries. In this article, learn how to:
18
18
19
-
In this article, learn how to:
20
-
21
-
- Define a `filter` expression
22
-
- Set the `vectorFilterMode` to control whether the filter executes before or after the query.
19
+
> [!div class="checklist"]
20
+
> -[Define a `filter` expression](#define-a-filter)
21
+
> -[Set the `vectorFilterMode` for pre-query or post-query filtering](#set-the-vectorfiltermode)
23
22
24
23
This article uses REST for illustration. For code samples in other languages, see the [azure-search-vector-samples](https://github.com/Azure/azure-search-vector-samples) GitHub repository for end-to-end solutions that include vector queries.
25
24
26
25
You can also use [Search Explorer](search-get-started-portal-import-vectors.md#check-results) in the Azure portal to query vector content. If you use the JSON view, you can add filters and specify the filter mode.
27
26
28
27
## How filtering works in a vector query
29
28
30
-
Filters apply to `filterable` nonvector fields, either a string field or numeric, and are useful for including or excluding search documents. Although a vector field isn't filterable itself, filters can be applied to other fields in the same index, including or excluding the documents that also contain vector fields.
29
+
Filters apply to `filterable` nonvector fields, either a string field or numeric, to include or exclude search documents based on filter criteria. Although a vector field isn't filterable itself, filters can be applied to other fields in the same index, including or excluding the documents that also contain vector fields.
31
30
32
-
Filters can be applied before the query executes, or after query execution to filter search results. Set the `vectorFilterMode`
31
+
Filters are applied before or after query execution based on the `vectorFilterMode` parameter.
33
32
34
33
## Define a filter
35
34
@@ -121,7 +120,9 @@ The vectorFilterMode query parameter determines whether the filter is applied be
121
120
122
121
### Use prefilter mode
123
122
124
-
Prefiltering applies filters before query execution, reducing the search surface area over which the vector search algorithm looks for similar content. In a vector query, `preFilter` is the default.
123
+
Prefiltering applies filters before query execution, reducing the search surface area over which the vector search algorithm looks for similar content.
124
+
125
+
In a vector query, `preFilter` is the default.
125
126
126
127
:::image type="content" source="media/vector-search-filters/pre-filter.svg" alt-text="Diagram of prefilters." border="true" lightbox="media/vector-search-filters/pre-filter.png":::
0 commit comments