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/search-faceted-navigation.md
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,14 +15,15 @@ ms.date: 02/26/2025
15
15
16
16
Faceted navigation is used for self-directed drilldown filtering on query results in a search app, where your application offers form controls for scoping search to groups of documents (for example, categories or brands), and Azure AI Search provides the data structures and filters to back the experience.
17
17
18
-
In this article, learn the basic steps for creating a faceted navigation structure in Azure AI Search.
18
+
In this article, learn how to create a faceted navigation structure in Azure AI Search.
19
19
20
20
<!-- > [!div class="checklist"]
21
21
> * Set field attributes in the index
22
22
> * Structure the request and response
23
23
> * Add navigation controls and filters in the presentation layer
24
-
-->
24
+
25
25
Code in the presentation layer does the heavy lifting in a faceted navigation experience. The demos and samples listed at the end of this article provide working code that shows you how to bring everything together.
26
+
-->
26
27
27
28
## Faceted navigation in a search page
28
29
@@ -34,9 +35,9 @@ In Azure AI Search, facets are one layer deep and can't be hierarchical. If you
34
35
35
36
Facets can help you find what you're looking for, while ensuring that you don't get zero results. As a developer, facets let you expose the most useful search criteria for navigating your search index.
36
37
37
-
## Enable facets in the index
38
+
## Add facets to an index
38
39
39
-
Faceting is enabled on a field-by-field basis in an index definition when you set the "facetable" attribute to true.
40
+
Facets are enabled on a field-by-field basis in an index definition when you set the "facetable" attribute to true.
40
41
41
42
Although it's not strictly required, you should also set the "filterable" attribute so that you can build the necessary filters that back the faceted navigation experience in your search application.
42
43
@@ -65,7 +66,12 @@ Facets can be calculated over single-value fields and collections. Fields that w
65
66
66
67
* Short descriptive values (one or two words) that render nicely in a navigation tree
67
68
68
-
The values within a field, and not the field name itself, produces the facets in a faceted navigation structure. If the facet is a string field named *Color*, facets are blue, green, and any other value for that field.
69
+
The values within a field, and not the field name itself, produce the facets in a faceted navigation structure. If the facet is a string field named *Color*, facets are blue, green, and any other value for that field.
70
+
71
+
You can't use `Edm.GeographyPoint` or `Collection(Edm.GeographyPoint)` fields in faceted navigation. Facets work best on fields with low cardinality. Due to the resolution of geo-coordinates, it's rare that any two sets of coordinates are equal in a given dataset. As such, facets aren't supported for geo-coordinates. You should use a city or region field to facet by location.
72
+
73
+
> [!TIP]
74
+
> As a best practice for performance and storage optimization, turn faceting off for fields that should never be used as a facet. In particular, string fields for unique values, such as an ID or product name, should be set to `"facetable": false` to prevent their accidental (and ineffective) use in faceted navigation. This is especially true for the REST API that enables filters and facets by default.
69
75
70
76
As a best practice, check fields for null values, misspellings or case discrepancies, and single and plural versions of the same word. By default, filters and facets don't undergo lexical analysis or [spell check](speller-how-to-add.md), which means that all values of a "facetable" field are potential facets, even if the words differ by one character. Optionally, you can [assign a normalizer](search-normalizers.md) to a "filterable" and "facetable" field to smooth out variations in casing and characters.
71
77
@@ -79,14 +85,9 @@ If you're using one of the Azure SDKs, your code must explicitly set the field a
79
85
*`Edm.Int32`, `Edm.Int64`, `Edm.Double`
80
86
* Collections of any of the above types, for example `Collection(Edm.String)` or `Collection(Edm.Double)`
81
87
82
-
You can't use `Edm.GeographyPoint` or `Collection(Edm.GeographyPoint)` fields in faceted navigation. Facets work best on fields with low cardinality. Due to the resolution of geo-coordinates, it's rare that any two sets of coordinates are equal in a given dataset. As such, facets aren't supported for geo-coordinates. You would need a city or region field to facet by location.
83
-
84
-
> [!TIP]
85
-
> As a best practice for performance and storage optimization, turn faceting off for fields that should never be used as a facet. In particular, string fields for unique values, such as an ID or product name, should be set to `"facetable": false` to prevent their accidental (and ineffective) use in faceted navigation. This is especially true for the REST API that enables filters and facets by default.
86
-
87
88
## Facet request and response
88
89
89
-
Facets are specified on the query, and the faceted navigation structure is returned at the top of the response. The structure of a request and response is fairly simple. In fact, the real work behind faceted navigation lies in the presentation layer, covered in a later section.
90
+
Facets are specified on the query, and the faceted navigation structure is returned at the top of the response.
90
91
91
92
The following REST example is an unqualified query (`"search": "*"`) that is scoped to the entire index (see the [built-in hotels sample](search-get-started-portal.md)). Facets are usually a list of fields, but this query shows just one for a more readable response.
0 commit comments