Skip to content

Commit 2718902

Browse files
committed
checkpoint
1 parent 2f174ca commit 2718902

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

articles/search/search-get-started-dotnet.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ms.topic: quickstart
1111
ms.date: 01/27/2023
1212
ms.custom: devx-track-csharp, mode-api
1313
---
14+
1415
# Quickstart: Create a search index using the Azure.Search.Documents client library
1516

1617
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:
2627

2728
+ An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/).
2829

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.
3031

3132
+ [Visual Studio](https://visualstudio.microsoft.com/downloads/), any edition. Sample code was tested on the free Community edition of Visual Studio 2019.
3233

3334
When setting up your project, you'll download the [Azure.Search.Documents NuGet package](https://www.nuget.org/packages/Azure.Search.Documents/).
3435

3536
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+
3638
## Set up your project
3739

3840
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
5759

5860
1. Start Visual Studio and create a .NET Core console application.
5961

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...**.
6163

6264
1. Select **Browse**.
6365

@@ -157,7 +159,7 @@ In this example, synchronous methods of the Azure.Search.Documents library are u
157159
158160
+ `SearchableField` must be a string, and is always searchable and retrievable. Other attributes are off by default, but can be enabled. Because this field type is searchable, it supports synonyms and the full complement of analyzer properties. For more information, see the [SearchableFieldAttribute.cs](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/search/Azure.Search.Documents/src/Indexes/SearchableFieldAttribute.cs) in source code.
159161
160-
Whether you use the basic `SearchField` API or either one of the helper models, you must explicitly enable filter, facet, and sort attributes. For example, [IsFilterable](/dotnet/api/azure.search.documents.indexes.models.searchfield.isfilterable), [IsSortable](/dotnet/api/azure.search.documents.indexes.models.searchfield.issortable), and [IsFacetable](/dotnet/api/azure.search.documents.indexes.models.searchfield.isfacetable) must be explicitly attributed, as shown in the sample above.
162+
Whether you use the basic `SearchField` API or either one of the helper models, you must explicitly enable filter, facet, and sort attributes. For example, [IsFilterable](/dotnet/api/azure.search.documents.indexes.models.searchfield.isfilterable), [IsSortable](/dotnet/api/azure.search.documents.indexes.models.searchfield.issortable), and [IsFacetable](/dotnet/api/azure.search.documents.indexes.models.searchfield.isfacetable) must be explicitly attributed, as shown in the sample above.
161163

162164
1. Add a second empty class definition to your project: **Address.cs**. Copy the following code into the class.
163165

@@ -212,7 +214,7 @@ In this example, synchronous methods of the Azure.Search.Documents library are u
212214

213215
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.
214216

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.
216218

217219
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)).
218220

@@ -404,7 +406,7 @@ The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) c
404406
WriteDocuments(response);
405407
```
406408

407-
1. In the second query, search on a term, add a filter that selects documents where Rating is greater than 4, and then sort by Rating in descending order. Filter is a boolean expression that is evaluated over [IsFilterable](/dotnet/api/azure.search.documents.indexes.models.searchfield.isfilterable) fields in an index. Filter queries either include or exclude values. As such, there's no relevance score associated with a filter query.
409+
1. In the second query, search on a term, add a filter that selects documents where Rating is greater than 4, and then sort by Rating in descending order. Filter is a boolean expression that is evaluated over [IsFilterable](/dotnet/api/azure.search.documents.indexes.models.searchfield.isfilterable) fields in an index. Filter queries either include or exclude values. As such, there's no relevance score associated with a filter query.
408410

409411
```csharp
410412
// Query 2
@@ -443,7 +445,7 @@ The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) c
443445
WriteDocuments(response);
444446
```
445447

446-
1. The fourth query demonstrates facets, which can be used to structure a faceted navigation structure.
448+
1. The fourth query demonstrates facets, which can be used to structure a faceted navigation structure.
447449

448450
```csharp
449451
// Query 4
@@ -485,6 +487,7 @@ The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) c
485487
var autoresponse = srchclient.Autocomplete("sa", "sg");
486488
WriteDocuments(autoresponse);
487489
```
490+
488491
1. Add **RunQueries** to Main().
489492

490493
```csharp
@@ -503,7 +506,7 @@ Full text search and filters are performed using the [SearchClient.Search](/dotn
503506

504507
## Run the program
505508

506-
Press F5 to rebuild the app and run the program in its entirety.
509+
Press F5 to rebuild the app and run the program in its entirety.
507510

508511
Output includes messages from [Console.WriteLine](/dotnet/api/system.console.writeline), with the addition of query information and results.
509512

@@ -513,7 +516,7 @@ When you're working in your own subscription, it's a good idea at the end of a p
513516

514517
You can find and manage resources in the portal, using the **All resources** or **Resource groups** link in the left-navigation pane.
515518

516-
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.
519+
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.
517520

518521
## Next steps
519522

0 commit comments

Comments
 (0)