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-get-started-dotnet.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,12 @@ ms.author: heidist
8
8
ms.service: cognitive-search
9
9
ms.devlang: csharp
10
10
ms.topic: quickstart
11
-
ms.date: 06/11/2021
11
+
ms.date: 08/29/2022
12
12
ms.custom: devx-track-csharp, mode-api
13
13
---
14
14
# Quickstart: Create a search index using the Azure.Search.Documents client library
15
15
16
-
Use the new [Azure.Search.Documents (version 11) client library](/dotnet/api/overview/azure/search.documents-readme) to create a .NET Core console application in C# that creates, loads, and queries a search index.
16
+
Use the [Azure.Search.Documents (version 11) client library](/dotnet/api/overview/azure/search.documents-readme) to create a .NET Core console application in C# that creates, loads, and queries a search index.
17
17
18
18
You can [download the source code](https://github.com/Azure-Samples/azure-search-dotnet-samples/tree/master/quickstart/v11) to start with a finished project or follow the steps in this article to create your own.
19
19
@@ -30,7 +30,7 @@ Before you begin, have the following tools and services:
30
30
31
31
+[Visual Studio](https://visualstudio.microsoft.com/downloads/), any edition. Sample code was tested on the free Community edition of Visual Studio 2019.
32
32
33
-
When setting up your project, you will download the [Azure.Search.Documents NuGet package](https://www.nuget.org/packages/Azure.Search.Documents/).
33
+
When setting up your project, you'll download the [Azure.Search.Documents NuGet package](https://www.nuget.org/packages/Azure.Search.Documents/).
34
34
35
35
Azure SDK for .NET conforms to [.NET Standard 2.0](/dotnet/standard/net-standard#net-implementation-support), which means .NET Framework 4.6.1 and .NET Core 2.0 as minimum requirements.
36
36
@@ -42,11 +42,11 @@ Assemble service connection information, and then start Visual Studio to create
42
42
43
43
### Copy a key and endpoint
44
44
45
-
Calls to the service require a URL endpoint and an access key on every request. As a first step, find the API key and URL to add to your project. You will specify both values when creating the client in a later step.
45
+
Calls to the service require a URL endpoint and an access key on every request. As a first step, find the API key and URL to add to your project. You'll specify both values when creating the client in a later step.
46
46
47
47
1.[Sign in to the Azure portal](https://portal.azure.com/), and in your search service **Overview** page, get the URL. An example endpoint might look like `https://mydemo.search.windows.net`.
48
48
49
-
2. In **Settings** > **Keys**, get an admin key for full rights on the service, required if you are creating or deleting objects. There are two interchangeable primary and secondary keys. You can use either one.
49
+
2. In **Settings** > **Keys**, get an admin key for full rights on the service, required if you're creating or deleting objects. There are two interchangeable primary and secondary keys. You can use either one.
50
50
51
51

52
52
@@ -60,11 +60,11 @@ After the project is created, add the client library. The [Azure.Search.Document
60
60
61
61
1. In **Tools** > **NuGet Package Manager**, select **Manage NuGet Packages for Solution...**.
62
62
63
-
1.Click**Browse**.
63
+
1.Select**Browse**.
64
64
65
65
1. Search for `Azure.Search.Documents` and select version 11.0 or later.
66
66
67
-
1.Click**Install** on the right to add the assembly to your project and solution.
67
+
1.Select**Install** on the right to add the assembly to your project and solution.
68
68
69
69
### Create a search client
70
70
@@ -104,7 +104,7 @@ In this example, synchronous methods of the Azure.Search.Documents library are u
1. Copythefollowingcodeinto**Hotel.cs**todefinethestructureofahoteldocument. Attributesonthefielddeterminehowitisusedinanapplication. Forexample, the `IsFilterable` attributemustbeassignedtoeveryfieldthatsupportsafilterexpression.
107
+
1. Copythefollowingcodeinto**Hotel.cs**todefinethestructureofahoteldocument. Attributesonthefielddeterminehowit's used in an application. For example, the `IsFilterable` attribute must be assigned to every field that supports a filter expression.
108
108
109
109
```csharp
110
110
usingSystem;
@@ -185,7 +185,7 @@ In this example, synchronous methods of the Azure.Search.Documents library are u
1. Createtwomoreclasses: **Hotel.Methods.cs**and**Address.Methods.cs**forToString() overrides. Theseclassesareusedtorendersearchresultsintheconsoleoutput. Thecontentsoftheseclassesaren't provided in this article, but you can copy the code from [files in GitHub](https://github.com/Azure-Samples/azure-search-dotnet-samples/tree/master/quickstart/v11/AzureSearchQuickstart-v11).
Ifyou're using a free service, remember that you'relimitedtothreeindexes, indexers, anddatasources. Youcandeleteindividualitemsintheportaltostayunderthelimit.
*[azure-search-documents package](https://pypi.org/project/azure-search-documents/) from the Azure SDK for Python
36
36
37
37
*[Create a search service](search-create-service-portal.md) or [find an existing service](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Search%2FsearchServices) under your current subscription. You can use the Free tier for this quickstart.
38
38
@@ -50,7 +50,7 @@ All requests require an api-key on every request sent to your service. Having a
50
50
51
51
## Connect to Azure Cognitive Search
52
52
53
-
In this task, start Jupyter Notebook and verify that you can connect to Azure Cognitive Search. You'll do this by requesting a list of indexes from your service. On Windows with Anaconda3, you can use Anaconda Navigator to launch a notebook.
53
+
In this task, start Jupyter Notebook and verify that you can connect to Azure Cognitive Search. You'll do this step by requesting a list of indexes from your service.
54
54
55
55
1. Create a new Python3 notebook.
56
56
@@ -75,10 +75,10 @@ In this task, start Jupyter Notebook and verify that you can connect to Azure Co
75
75
)
76
76
```
77
77
78
-
1. In the second cell, input the request elements that will be constants on every request. Provide your search service name, admin API key, and query API key, copied in a previous step. This cell also sets up the clients you will use for specific operations: [SearchIndexClient](/python/api/azure-search-documents/azure.search.documents.indexes.searchindexclient) to create an index, and [SearchClient](/python/api/azure-search-documents/azure.search.documents.searchclient) to query an index.
78
+
1. In the second cell, input the request elements that will be constants on every request. Provide your search service name, admin API key, and query API key, copied in a previous step. This cell also sets up the clients you'll use for specific operations: [SearchIndexClient](/python/api/azure-search-documents/azure.search.documents.indexes.searchindexclient) to create an index, and [SearchClient](/python/api/azure-search-documents/azure.search.documents.searchclient) to query an index.
79
79
80
80
```python
81
-
service_name ="YOUR-SEARCH-SERIVCE-NAME"
81
+
service_name ="YOUR-SEARCH-SERVICE-NAME"
82
82
admin_key ="YOUR-SEARCH-SERVICE-ADMIN-API-KEY"
83
83
84
84
index_name ="hotels-quickstart"
@@ -110,7 +110,7 @@ In this task, start Jupyter Notebook and verify that you can connect to Azure Co
110
110
111
111
Required elements of an index include a name, a fields collection, and a key. The fields collection defines the structure of a logical *search document*, used for both loading data and returning results.
112
112
113
-
Each field has a name, type, and attributes that determine how the field is used (for example, whether it is full-text searchable, filterable, or retrievable in search results). Within an index, one of the fields of type `Edm.String` must be designated as the *key* for document identity.
113
+
Each field has a name, type, and attributes that determine how the field is used (for example, whether it's full-text searchable, filterable, or retrievable in search results). Within an index, one of the fields of type `Edm.String` must be designated as the *key* for document identity.
114
114
115
115
This index is named "hotels-quickstart" and has the field definitions you see below. It's a subset of a larger [Hotels index](https://github.com/Azure-Samples/azure-search-sample-data/blob/master/hotels/Hotels_IndexDefinition.JSON) used in other walkthroughs. We trimmed it in this quickstart for brevity.
116
116
@@ -318,7 +318,7 @@ This step shows you how to query an index using the **search** method of the [se
318
318
print("{}".format(facet))
319
319
```
320
320
321
-
1. In this example, look up a specific document based on its key. You would typically want to return a document when a user clicks on a document in a search result.
321
+
1. In this example, look up a specific document based on its key. You would typically want to return a document when a user select on a document in a search result.
322
322
323
323
```python
324
324
result = search_client.get_document(key="3")
@@ -329,7 +329,7 @@ This step shows you how to query an index using the **search** method of the [se
329
329
print("Category: {}".format(result["Category"]))
330
330
```
331
331
332
-
1. In this example, we'll use the autocomplete function. This is typically used in a search box to help auto-complete potential matches as the user types into the search box.
332
+
1. In this example, we'll use the autocomplete function. Autocomplete is typically used in a search box to provide potential matches as the user types into the search box.
333
333
334
334
When the index was created, a suggester named "sg" was also created as part of the request. A suggester definition specifies which fields can be used to find potential matches to suggester requests. In this example, those fields are 'Tags', 'Address/City', 'Address/Country'. To simulate auto-complete, passin the letters "sa"as a partial string. The autocomplete method of [SearchClient](/python/api/azure-search-documents/azure.search.documents.searchclient) sends back potential term matches.
335
335
@@ -348,7 +348,7 @@ When you're working in your own subscription, it's a good idea at the end of a p
348
348
349
349
You can find and manage resources in the portal, using the **All resources**or**Resource groups** link in the left-navigation pane.
350
350
351
-
If you are using a free service, remember that you are limited to three indexes, indexers, and data sources. You can delete individual items in the portal to stay under the limit.
351
+
If you're using a free service, remember that you're limited to three indexes, indexers, and data sources. You can delete individual items in the portal to stay under the limit.
0 commit comments