|
1 | 1 | ---
|
2 |
| -title: Add autocomplete to a search box |
| 2 | +title: Autocomplete or typeahead |
3 | 3 | titleSuffix: Azure Cognitive Search
|
4 |
| -description: Enable search-as-you-type query actions in Azure Cognitive Search by creating suggesters and formulating requests that autocomplete a search box with finished terms or phrases. You can also return suggested matches. |
| 4 | +description: Enable search-as-you-type query actions in Azure Cognitive Search by creating suggesters and queries that autocomplete a search string with finished terms or phrases. You can also return suggested matches. |
5 | 5 |
|
6 | 6 | manager: nitinme
|
7 | 7 | author: HeidiSteen
|
8 | 8 | ms.author: heidist
|
9 | 9 | ms.service: cognitive-search
|
10 | 10 | ms.topic: conceptual
|
11 |
| -ms.date: 09/12/2022 |
| 11 | +ms.date: 10/03/2023 |
12 | 12 | ms.custom: devx-track-csharp
|
13 | 13 | ---
|
14 | 14 |
|
15 |
| -# Add autocomplete and suggestions to client apps using Azure Cognitive Search |
| 15 | +# How to add autocomplete and search suggestions in client apps |
16 | 16 |
|
17 | 17 | Search-as-you-type is a common technique for improving query productivity. In Azure Cognitive Search, this experience is supported through *autocomplete*, which finishes a term or phrase based on partial input (completing "micro" with "microsoft"). A second user experience is *suggestions*, or a short list of matching documents (returning book titles with an ID so that you can link to a detail page about that book). Both autocomplete and suggestions are predicated on a match in the index. The service won't offer queries that return zero results.
|
18 | 18 |
|
19 |
| -To implement these experiences in Azure Cognitive Search, you will need: |
| 19 | +To implement these experiences in Azure Cognitive Search: |
20 | 20 |
|
21 |
| -+ A *suggester* definition that's embedded in the index schema. |
22 |
| -+ A *query* specifying [Autocomplete](/rest/api/searchservice/autocomplete) or [Suggestions](/rest/api/searchservice/suggestions) API on the request. |
23 |
| -+ A *UI control* to handle search-as-you-type interactions in your client app. We recommend using an existing JavaScript library for this purpose. |
| 21 | ++ Add a `suggester` to an index schema |
| 22 | ++ Build a query that calls the [Autocomplete](/rest/api/searchservice/autocomplete) or [Suggestions](/rest/api/searchservice/suggestions) API on the request. |
| 23 | ++ Add a UI control to handle search-as-you-type interactions in your client app. We recommend using an existing JavaScript library for this purpose. |
24 | 24 |
|
25 | 25 | In Azure Cognitive Search, autocompleted queries and suggested results are retrieved from the search index, from selected fields that you have registered with a suggester. A suggester is part of the index, and it specifies which fields will provide content that either completes a query, suggests a result, or does both. When the index is created and loaded, a suggester data structure is created internally to store prefixes used for matching on partial queries. For suggestions, choosing suitable fields that are unique, or at least not repetitive, is essential to the experience. For more information, see [Create a suggester](index-add-suggesters.md).
|
26 | 26 |
|
27 |
| -The remainder of this article is focused on queries and client code. It uses JavaScript and C# to illustrate key points. REST API examples are used to concisely present each operation. For links to end-to-end code samples, see [Next steps](#next-steps). |
| 27 | +The remainder of this article is focused on queries and client code. It uses JavaScript and C# to illustrate key points. REST API examples are used to concisely present each operation. For end-to-end code samples, see [Next steps](#next-steps). |
28 | 28 |
|
29 | 29 | ## Set up a request
|
30 | 30 |
|
|
0 commit comments