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
+7-16Lines changed: 7 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,6 +185,7 @@ To guarantee accuracy, you can artificially inflate the count:\<number> to a lar
185
185
186
186
The tradeoff with this workaround is increased query latency, so use it only when necessary.
187
187
188
+
<!--
188
189
## Presentation layer
189
190
190
191
In application code, the pattern is to use facet query parameters to return the faceted navigation structure along with facet results, plus a `$filter` expression. The filter expression handles the click event and further narrows the search result based on the facet selection.
@@ -204,7 +205,7 @@ Here's another example from the hotels sample. The following code snippet adds `
204
205
if (!String.IsNullOrEmpty(categoryFacet))
205
206
filter = $"category eq '{categoryFacet}'";
206
207
```
207
-
<!--
208
+
208
209
### HTML for faceted navigation
209
210
210
211
The following example, taken from the `index.cshtml` file of the NYCJobs sample application, shows the static HTML structure for displaying faceted navigation on the search results page. The list of facets is built or rebuilt dynamically when you submit a search term, or select or clear a facet.
@@ -255,13 +256,13 @@ This section is a collection of tips and workarounds that might be helpful.
255
256
256
257
### Preserve a facet navigation structure asynchronously of filtered results
257
258
258
-
One of the challenges of faceted navigation in Azure AI Search is that facets exist for current results only. In practice, it's common to retain a static set of facets so that the user can navigate in reverse, retracing steps to explore alternative paths through search content.
259
+
In Azure AI Search, facets exist for current results only. However, it's a common application requirement to retain a static set of facets so that the user can navigate in reverse, retracing steps to explore alternative paths through search content.
259
260
260
-
Although this is a common use case, it's not something the faceted navigation structure currently provides out-of-the-box. Developers who want static facets typically work around the limitation by issuing two filtered queries: one scoped to the results, the other used to create a static list of facets for navigation purposes.
261
+
If you want a static set of facets alongside a dynamic drilldown experience, you can implement it by using two filtered queries: one scoped to the results, the other used to create a static list of facets for navigation purposes.
261
262
262
263
### Clear facets
263
264
264
-
When you design the search results page, remember to add a mechanism for clearing facets. If you add check boxes, you can easily see how to clear the filters. For other layouts, you might need a breadcrumb pattern or another creative approach. In the hotels C# sample, you can send an empty search to reset the page. In contrast, the NYCJobs sample application provides a clickable `[X]` after a selected facet to clear the facet, which is a stronger visual queue to the user.
265
+
When you design the user experience, remember to add a mechanism for clearing facets. A common approach for clearing facets is issue an empty search request to reset the page.
265
266
266
267
### Trim facet results with more filters
267
268
@@ -276,16 +277,6 @@ Content type
276
277
277
278
In general, if you find that facet results are consistently too large, we recommend that you add more filters to give users more options for narrowing the search.
278
279
279
-
### A facet-only search experience
280
-
281
-
If your application uses faceted navigation exclusively (that is, no search box), you can mark the field as `searchable=false`, `filterable=true`, `facetable=true` to produce a more compact index. Your index won't include inverted indexes and there is no text analysis or tokenization during indexing. Filters are made on exact matches at the character level.
282
-
283
-
### Validate inputs at query-time
284
-
285
-
If you build the list of facets dynamically based on untrusted user input, validate that the names of the faceted fields are valid. Or, escape the names when building URLs by using either `Uri.EscapeDataString()` in .NET, or the equivalent in your platform of choice.
286
-
287
-
## Samples
288
-
289
-
We recommend the following samples for faceted navigation. The samples also include filters, suggestions, and autocomplete. These samples use React for the presentation layer.
280
+
## Next steps
290
281
291
-
*[C#: Add search to web apps](tutorial-csharp-overview.md)
282
+
We recommend the [C#: Add search to web apps](tutorial-csharp-overview.md) for an example of faceted navigation. The sample also includes filters, suggestions, and autocomplete. It uses JavaScript and React for the presentation layer.
0 commit comments