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/tutorial-create-custom-analyzer.md
+63-63Lines changed: 63 additions & 63 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.date: 03/07/2024
13
13
14
14
# Tutorial: Create a custom analyzer for phone numbers
15
15
16
-
In search solutions, strings that have complex patterns or special characters can be a challenge to work with because the [default analyzer](search-analyzers.md) strips out or misinterprets meaningful parts of a pattern, resulting in a poor search experience when users can't find the information they want. Phone numbers are a good example of strings that are hard to analyze. They come in a variety of formats, and they include special characters that the default analyzer ignores.
16
+
In search solutions, strings that have complex patterns or special characters can be a challenge to work with because the [default analyzer](search-analyzers.md) strips out or misinterprets meaningful parts of a pattern, resulting in a poor search experience when users can't find the information they expected. Phone numbers are a classic example of strings that are hard to analyze. They come in a variety of formats, and they include special characters that the default analyzer ignores.
17
17
18
18
With phone numbers as its subject, this tutorial takes a close look at the problems of patterned data, and shows you to solve that problem using a [custom analyzer](index-add-custom-analyzers.md). The approach outlined here can be used as-is for phone numbers, or adapted for fields having the same characteristics (patterned, with special characters), such as URLs, emails, postal codes, and dates.
19
19
@@ -33,11 +33,11 @@ The following services and tools are required for this tutorial.
33
33
34
34
+[Azure AI Search](search-what-is-azure-search.md). [Create](search-create-service-portal.md) or [find an existing Azure AI Search resource](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Search%2FsearchServices) under your current subscription. You can use a free service for this quickstart.
35
35
36
-
## Download files
36
+
###Download files
37
37
38
38
Source code for this tutorial is in the [custom-analyzers](https://github.com/Azure-Samples/azure-search-postman-samples/tree/main/custom-analyzers) folder in the [Azure-Samples/azure-search-postman-samples](https://github.com/Azure-Samples/azure-search-postman-samples) GitHub repository.
39
39
40
-
## Copy a key and URL
40
+
###Copy a key and URL
41
41
42
42
The REST calls in this tutorial require a search service endpoint and an admin API key. You can get these values from the Azure portal.
43
43
@@ -150,9 +150,9 @@ A valid API key establishes trust, on a per request basis, between the applicati
150
150
}
151
151
```
152
152
153
-
1. Let's try a few queries that mimic what a user might type. A user could search for `(425) 555-0100` in any number of formats and still expect results to be returned. Start by searching `(425) 555-0100`:
153
+
1. Let's try a few queries similar to what a user might type. A user could search for `(425) 555-0100` in any number of formats and still expect results to be returned. Start by searching `(425) 555-0100`:
154
154
155
-
```http
155
+
```http
156
156
### Search for a phone number
157
157
GET {{baseUrl}}/indexes/phone-numbers-index/docs/search?api-version=2023-11-01&search=(425) 555-0100 HTTP/1.1
158
158
Content-Type: application/json
@@ -212,7 +212,7 @@ A valid API key establishes trust, on a per request basis, between the applicati
212
212
213
213
If you find these results confusing, you're not alone. In the next section, let's dig into why we're getting these results.
214
214
215
-
## How analyzers work
215
+
## Review how analyzers work
216
216
217
217
To understand these search results, we need to understand what the analyzer is doing. From there, we can test the default analyzer using the [Analyze API](/rest/api/searchservice/indexes/analyze), providing a foundation for designing an analyzer that better meets our needs.
218
218
@@ -443,70 +443,70 @@ All of the tokens in the output column exist in the index. If our query includes
443
443
444
444
1. Recreate the index using the new analyzer. This index schema adds a custom analyzer definition, and a custom analyzer assignment on the phone number field.
445
445
446
-
```http
446
+
```http
447
447
### Create a new index
448
448
POST {{baseUrl}}/indexes?api-version=2023-11-01 HTTP/1.1
<!-- With the custom analyzer defined, recreate the index so that the custom analyzer will be available for testing in the next step. For simplicity, the Postman collection creates a new index named `tutorial-first-analyzer` with the analyzer we defined. -->
0 commit comments