Skip to content

Commit 5fc7dc5

Browse files
committed
Refresh articles
1 parent 024e54f commit 5fc7dc5

File tree

7 files changed

+150
-145
lines changed

7 files changed

+150
-145
lines changed

articles/search/cognitive-search-defining-skillset.md

Lines changed: 30 additions & 30 deletions
Large diffs are not rendered by default.

articles/search/includes/quickstarts/dotnet.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ ms.service: cognitive-search
55
ms.custom:
66
- ignite-2023
77
ms.topic: include
8-
ms.date: 06/09/2023
8+
ms.date: 10/07/2024
99
---
1010

11-
Build a console application using the [**Azure.Search.Documents**](/dotnet/api/overview/azure/search.documents-readme) client library to create, load, and query a search index. Alternatively, you can [download the source code](https://github.com/Azure-Samples/azure-search-dotnet-samples/tree/main/quickstart/v11) to start with a finished project or follow these steps to create your own.
11+
Build a console application using the [Azure.Search.Documents](/dotnet/api/overview/azure/search.documents-readme) client library to create, load, and query a search index.
12+
13+
Alternatively, you can [download the source code](https://github.com/Azure-Samples/azure-search-dotnet-samples/tree/main/quickstart/v11) to start with a finished project or follow these steps to create your own.
1214

1315
#### Set up your environment
1416

@@ -20,7 +22,7 @@ Build a console application using the [**Azure.Search.Documents**](/dotnet/api/o
2022

2123
1. Search for [Azure.Search.Documents package](https://www.nuget.org/packages/Azure.Search.Documents/) and select version 11.0 or later.
2224

23-
1. Select **Install** on the right to add the assembly to your project and solution.
25+
1. Select **Install** to add the assembly to your project and solution.
2426

2527
#### Create a search client
2628

@@ -34,9 +36,9 @@ Build a console application using the [**Azure.Search.Documents**](/dotnet/api/o
3436
using Azure.Search.Documents.Models;
3537
```
3638

37-
1. Create two clients: [SearchIndexClient](/dotnet/api/azure.search.documents.indexes.searchindexclient) creates the index, and [SearchClient](/dotnet/api/azure.search.documents.searchclient) loads and queries an existing index. Both need the service endpoint and an admin API key for authentication with create/delete rights.
39+
1. Copy the following code to create two clients. [SearchIndexClient](/dotnet/api/azure.search.documents.indexes.searchindexclient) creates the index, and [SearchClient](/dotnet/api/azure.search.documents.searchclient) loads and queries an existing index. Both need the service endpoint and an admin API key for authentication with create/delete rights.
3840

39-
Because the code builds out the URI for you, specify just the search service name in the "serviceName" property.
41+
Because the code builds out the URI for you, specify just the search service name in the `serviceName` property.
4042

4143
```csharp
4244
static void Main(string[] args)
@@ -116,9 +118,9 @@ In this example, synchronous methods of the Azure.Search.Documents library are u
116118
117119
+ `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/main/sdk/search/Azure.Search.Documents/src/Indexes/SearchableFieldAttribute.cs) in source code.
118120
119-
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.
121+
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 previous sample.
120122

121-
1. Add a second empty class definition to your project: **Address.cs**. Copy the following code into the class.
123+
1. Add a second empty class definition to your project: **Address.cs**. Copy the following code into the class.
122124

123125
```csharp
124126
using Azure.Search.Documents.Indexes;
@@ -145,7 +147,7 @@ In this example, synchronous methods of the Azure.Search.Documents library are u
145147
}
146148
```
147149

148-
1. Create two more classes: **Hotel.Methods.cs** and **Address.Methods.cs** for ToString() overrides. These classes are used to render search results in the console output. The contents of these classes aren'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/main/quickstart/v11/AzureSearchQuickstart-v11).
150+
1. Create two more classes: **Hotel.Methods.cs** and **Address.Methods.cs** for `ToString()` overrides. These classes are used to render search results in the console output. The contents of these classes aren'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/main/quickstart/v11/AzureSearchQuickstart-v11).
149151

150152
1. In **Program.cs**, create a [SearchIndex](/dotnet/api/azure.search.documents.indexes.models.searchindex) object, and then call the [CreateIndex](/dotnet/api/azure.search.documents.indexes.searchindexclient.createindex) method to express the index in your search service. The index also includes a [SearchSuggester](/dotnet/api/azure.search.documents.indexes.models.searchsuggester) to enable autocomplete on the specified fields.
151153

@@ -173,7 +175,7 @@ In Azure AI Search, search documents are data structures that are both inputs to
173175

174176
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 AI Search what action to perform ([upload, merge, delete, and mergeOrUpload](/azure/search/search-what-is-data-import#indexing-actions)).
175177

176-
1. In **Program.cs**, create an array of documents and index actions, and then pass the array to `IndexDocumentsBatch`. The documents below conform to the hotels-quickstart index, as defined by the hotel class.
178+
1. In **Program.cs**, create an array of documents and index actions, and then pass the array to `IndexDocumentsBatch`. The following documents conform to the hotels-quickstart index, as defined by the hotel class.
177179

178180
```csharp
179181
// Upload documents in a single Upload request.
@@ -281,7 +283,7 @@ When uploading documents, you must use an [IndexDocumentsBatch](/dotnet/api/azur
281283

282284
Once you initialize the [IndexDocumentsBatch](/dotnet/api/azure.search.documents.models.indexdocumentsbatch-1) object, you can send it to the index by calling [IndexDocuments](/dotnet/api/azure.search.documents.searchclient.indexdocuments) on your [SearchClient](/dotnet/api/azure.search.documents.searchclient) object.
283285

284-
1. Add the following lines to Main(). Loading documents is done using SearchClient, but the operation also requires admin rights on the service, which is typically associated with SearchIndexClient. One way to set up this operation is to get SearchClient through SearchIndexClient (adminClient in this example).
286+
1. Add the following lines to `Main()`. Loading documents is done using SearchClient, but the operation also requires admin rights on the service, which is typically associated with SearchIndexClient. One way to set up this operation is to get SearchClient through `SearchIndexClient` (`adminClient` in this example).
285287

286288
```csharp
287289
SearchClient ingesterClient = adminClient.GetSearchClient(indexName);
@@ -309,7 +311,7 @@ This section adds two pieces of functionality: query logic, and results. For que
309311

310312
The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) class represents the results.
311313

312-
1. In **Program.cs**, create a **WriteDocuments** method that prints search results to the console.
314+
1. In **Program.cs**, create a `WriteDocuments` method that prints search results to the console.
313315

314316
```csharp
315317
// Write search results to console
@@ -334,7 +336,7 @@ The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) c
334336
}
335337
```
336338

337-
1. Create a **RunQueries** method to execute queries and return results. Results are Hotel objects. This sample shows the method signature and the first query. This query demonstrates the Select parameter that lets you compose the result using selected fields from the document.
339+
1. Create a `RunQueries` method to execute queries and return results. Results are Hotel objects. This sample shows the method signature and the first query. This query demonstrates the Select parameter that lets you compose the result using selected fields from the document.
338340

339341
```csharp
340342
// Run queries, use WriteDocuments to print output
@@ -361,7 +363,7 @@ The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) c
361363
WriteDocuments(response);
362364
```
363365

364-
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.
366+
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.
365367

366368
```csharp
367369
// Query 2
@@ -381,7 +383,7 @@ The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) c
381383
WriteDocuments(response);
382384
```
383385

384-
1. The third query demonstrates searchFields, used to scope a full text search operation to specific fields.
386+
1. The third query demonstrates `searchFields`, used to scope a full text search operation to specific fields.
385387

386388
```csharp
387389
// Query 3
@@ -400,7 +402,7 @@ The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) c
400402
WriteDocuments(response);
401403
```
402404

403-
1. The fourth query demonstrates facets, which can be used to structure a faceted navigation structure.
405+
1. The fourth query demonstrates `facets`, which can be used to structure a faceted navigation structure.
404406

405407
```csharp
406408
// Query 4
@@ -421,7 +423,7 @@ The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) c
421423
WriteDocuments(response);
422424
```
423425

424-
1. In the fifth query, return a specific document. A document lookup is a typical response to OnClick event in a result set.
426+
1. In the fifth query, return a specific document. A document lookup is a typical response to `OnClick` event in a result set.
425427

426428
```csharp
427429
// Query 5
@@ -433,7 +435,7 @@ The [SearchResults](/dotnet/api/azure.search.documents.models.searchresults-1) c
433435
Console.WriteLine(lookupResponse.Value.HotelId);
434436
```
435437

436-
1. The last query shows the syntax for autocomplete, simulating a partial user input of "sa" that resolves to two possible matches in the sourceFields associated with the suggester you defined in the index.
438+
1. The last query shows the syntax for autocomplete, simulating a partial user input of *sa* that resolves to two possible matches in the sourceFields associated with the suggester you defined in the index.
437439

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

446-
1. Add **RunQueries** to Main().
448+
1. Add `RunQueries` to `Main()`.
447449

448450
```csharp
449451
// Call the RunQueries method to invoke a series of queries
@@ -461,6 +463,6 @@ Full text search and filters are performed using the [SearchClient.Search](/dotn
461463

462464
#### Run the program
463465

464-
Press F5 to rebuild the app and run the program in its entirety.
466+
Press **F5** to rebuild the app and run the program in its entirety.
465467

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

0 commit comments

Comments
 (0)