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
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ ms.topic: quickstart
11
11
ms.date: 01/27/2023
12
12
ms.custom: devx-track-csharp, mode-api
13
13
---
14
+
14
15
# Quickstart: Create a search index using the Azure.Search.Documents client library
15
16
16
17
Learn how to 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.
@@ -26,13 +27,14 @@ Before you begin, have the following tools and services:
26
27
27
28
+ An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/).
28
29
29
-
+ An Azure Cognitive Search service. [Create a service](search-create-service-portal.md) or [find an existing service](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Search%2FsearchServices). You can use a free service for this quickstart.
30
+
+ An Azure Cognitive Search service. [Create a service](search-create-service-portal.md) or [find an existing service](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Search%2FsearchServices). You can use a free service for this quickstart.
30
31
31
32
+[Visual Studio](https://visualstudio.microsoft.com/downloads/), any edition. Sample code was tested on the free Community edition of Visual Studio 2019.
32
33
33
34
When setting up your project, you'll download the [Azure.Search.Documents NuGet package](https://www.nuget.org/packages/Azure.Search.Documents/).
34
35
35
36
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.1 as minimum requirements.
37
+
36
38
## Set up your project
37
39
38
40
Assemble service connection information, and then start Visual Studio to create a new Console App project that can run on. Select NET Core 3.1 for the run time.
@@ -57,7 +59,7 @@ After the project is created, add the client library. The [Azure.Search.Document
57
59
58
60
1. Start Visual Studio and create a .NET Core console application.
59
61
60
-
1. In **Tools** > **NuGet Package Manager**, select **Manage NuGet Packages for Solution...**.
62
+
1. In **Tools** > **NuGet Package Manager**, select **Manage NuGet Packages for Solution...**.
61
63
62
64
1. Select **Browse**.
63
65
@@ -157,7 +159,7 @@ In this example, synchronous methods of the Azure.Search.Documents library are u
157
159
158
160
+ `SearchableField` must be astring, andisalwayssearchableandretrievable. Otherattributesareoffbydefault, butcanbeenabled. Becausethisfieldtypeissearchable, itsupportssynonymsandthefullcomplementofanalyzerproperties. Formoreinformation, seethe [SearchableFieldAttribute.cs](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/search/Azure.Search.Documents/src/Indexes/SearchableFieldAttribute.cs) in source code.
1. Addasecondemptyclassdefinition to your project: **Address.cs**. Copythefollowingcodeintotheclass.
163
165
@@ -212,7 +214,7 @@ In this example, synchronous methods of the Azure.Search.Documents library are u
212
214
213
215
Azure Cognitive Search searches over content stored in the service. In this step, you'll load JSON documents that conform to the hotel index you just created.
214
216
215
-
In Azure Cognitive Search, search documents are data structures that are both inputs to indexing and outputs from queries. As obtained from an external data source, document inputs might be rows in a database, blobs in Blob storage, or JSON documents on disk. In this example, we're taking a shortcut and embedding JSON documents for four hotels in the code itself.
217
+
In Azure Cognitive Search, search documents are data structures that are both inputs to indexing and outputs from queries. As obtained from an external data source, document inputs might be rows in a database, blobs in Blob storage, or JSON documents on disk. In this example, we're taking a shortcut and embedding JSON documents for four hotels in the code itself.
216
218
217
219
When uploading documents, you must use an [IndexDocumentsBatch](/dotnet/api/azure.search.documents.models.indexdocumentsbatch-1) object. An `IndexDocumentsBatch` object contains a collection of [Actions](/dotnet/api/azure.search.documents.models.indexdocumentsbatch-1.actions), each of which contains a document and a property telling Azure Cognitive Search what action to perform ([upload, merge, delete, and mergeOrUpload](search-what-is-data-import.md#indexing-actions)).
218
220
@@ -404,7 +406,7 @@ The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) c
404
406
WriteDocuments(response);
405
407
```
406
408
407
-
1. Inthesecondquery, searchonaterm, addafilterthatselectsdocumentswhereRatingisgreaterthan 4, andthensortbyRatingindescendingorder. Filterisabooleanexpressionthatisevaluatedover [IsFilterable](/dotnet/api/azure.search.documents.indexes.models.searchfield.isfilterable) fieldsinanindex. Filterquerieseitherincludeorexcludevalues. Assuch, there's no relevance score associated with a filter query.
409
+
1. Inthesecondquery, searchonaterm, addafilterthatselectsdocumentswhereRatingisgreaterthan 4, andthensortbyRatingindescendingorder. Filterisabooleanexpressionthatisevaluatedover [IsFilterable](/dotnet/api/azure.search.documents.indexes.models.searchfield.isfilterable) fieldsinanindex. Filterquerieseitherincludeorexcludevalues. Assuch, there's no relevance score associated with a filter query.
408
410
409
411
```csharp
410
412
// Query 2
@@ -443,7 +445,7 @@ The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) c
Ifyou're using a free service, remember that you'relimitedtothreeindexes, indexers, anddatasources. Youcandeleteindividualitemsintheportaltostayunderthelimit.
519
+
Ifyou're using a free service, remember that you'relimitedtothreeindexes, indexers, anddatasources. Youcandeleteindividualitemsintheportaltostayunderthelimit.
0 commit comments