Skip to content

Commit 6a55138

Browse files
authored
Merge pull request #46 from HeidiSteen/master
Readme updates for v10/v11 versions
2 parents 45af5b6 + a1cd5b1 commit 6a55138

File tree

7 files changed

+95
-103
lines changed

7 files changed

+95
-103
lines changed

README.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,57 @@
11
# Azure Cognitive Search .NET Samples
22

3-
This repository contains C# sample code used in Azure Cognitive Search quickstarts, tutorials, and examples. All samples run on the shared (free) Azure Cognitive Search service.
3+
This repository contains C# sample code used in Azure Cognitive Search quickstarts, tutorials, and examples in product documentation. Unless otherwise noted, all samples run on the shared (free) pricing tier of an Azure Cognitive Search service.
44

5-
## Quickstart v11
5+
## Quickstart
66

7-
This version of the quickstart is updated to use the new Azure.Search.Documents client library (version 11) of the Azure SDK for .NET. This is a NET Core console app that uses the new library to create, load, and query an index.
7+
"Day One" introduction to the fundamental tasks of working with a search index: create, load, and query. This quickstart is a .NET Core console application that outputs the status of each operation, concluding with a series of sample queries as a validation step that the index exists and contains content. The index is modeled on a subset of the Hotels dataset, widely used in Cognitive Search samples, but reduced here for readability and comprehension.
88

9-
## Quickstart v10
9+
This sample is available in two versions:
1010

11-
This .NET Core console app uses the Azure Cognitive Search .NET SDK (version 10) to create an index, load it with documents, and execute a few queries. The index is modeled on a subset of the Hotels dataset, reduced for readability and comprehension. Index definition and documents are included in the code.
11+
+ **v10** uses the previous [Microsoft.Azure.Search](https://docs.microsoft.com/en-us/dotnet/api/overview/azure/search/client10) client libraries
12+
+ **v11** uses the new [Azure.Search.Documents](https://docs.microsoft.com/dotnet/api/overview/azure/search.documents-readme) client library, highly recommended for all new projects
1213

1314
## Create your first app
1415

15-
This MVC sample is a collection of projects that demonstrate a user experience using fictitious hotels data. The first project creates a basic search page. Additional projects build on the first, adding results handling, and typeahead. The index is pre-built and hosted so that you can focus on the application itself.
16+
This MVC sample is a collection of projects that demonstrate a user experience using fictitious hotels data. The first project creates a basic search page. Additional projects build on the first, adding pagination, autocomplete and suggested queries, and ordered results. The index is pre-built and hosted so that you can focus on the application itself.
17+
18+
This sample is available in two versions:
19+
20+
+ **v10** uses the previous [Microsoft.Azure.Search](https://docs.microsoft.com/en-us/dotnet/api/overview/azure/search/client10) client libraries
21+
+ **v11** uses the new [Azure.Search.Documents](https://docs.microsoft.com/dotnet/api/overview/azure/search.documents-readme) client library, highly recommended for all new projects
1622

1723
## Multiple data sources
1824

1925
This .NET Core console app uses Azure Cognitive Search indexers and the .NET SDK to import data from Azure Cosmos DB and Azure Blob storage, combing data from two sources into one search index.
2026

27+
This sample is available in two versions:
28+
29+
+ **v10** uses the previous [Microsoft.Azure.Search](https://docs.microsoft.com/en-us/dotnet/api/overview/azure/search/client10) client libraries
30+
+ **v11** uses the new [Azure.Search.Documents](https://docs.microsoft.com/dotnet/api/overview/azure/search.documents-readme) client library, highly recommended for all new projects
31+
2132
## Backup and restore an index
2233

23-
This .NET Core console app uses the .NET SDK and Azure Cognitive Search REST API to backup an index (schema and documents) to your computer and then uses the stored back up to recreate the index in a target search service that you specify. This tool is useful if you want to move an index into a different pricing tier. For example, you may use the Basic or Free pricing tier to develop your index, and then want to move it to the Standard or higher tier for production use. You can also use it to backup the index to your computer, so you can restore it at a later time, if needed.
34+
This .NET Core console app backs up an index (schema and documents) to your local computer and then uses the stored backup to recreate the index in a target search service that you specify. This sample can be helpful if you want to move an index into a different pricing tier. For example, you may use the Basic or Free pricing tier to develop your index, and then move it to the Standard or higher tier for production use.
35+
36+
This sample is available in two versions:
2437

25-
**IMPORTANT** Search indexes are different from other datastores because they are constantly ranking and scoring results and data may shift. It is possible to miss some data during data extraction. This sample code also only works for indexes with less than 100,000 documents. However, it can be amended for larger indexes. See the README in the index-backup-restore folder for more details.
38+
+ **v10** uses the previous [Microsoft.Azure.Search](https://docs.microsoft.com/en-us/dotnet/api/overview/azure/search/client10) client libraries
39+
+ **v11** uses the new [Azure.Search.Documents](https://docs.microsoft.com/dotnet/api/overview/azure/search.documents-readme) client library, highly recommended for all new projects
2640

2741
## Optimize data indexing
2842

2943
This .NET Core console app builds off of the code used in the Quickstart and uses the Azure Cognitive Search .NET SDK to create an index, and efficiently load it with documents. The app allows users to test various batch sizes to understand the optimal batch size and then demonstrates how to efficiently upload 100,000 documents to a search index. This is done by splitting the data into batches, and spinning up several threads to upload the documents. Any failures are monitored and then retried using the exponential backoff retry strategy. The index is modeled on a subset of the Hotels dataset, reduced for readability and comprehension. Index definition and documents are included in the code.
3044

45+
This sample is available in two versions:
46+
47+
+ **v10** uses the previous [Microsoft.Azure.Search](https://docs.microsoft.com/en-us/dotnet/api/overview/azure/search/client10) client libraries
48+
+ **v11** uses the new [Azure.Search.Documents](https://docs.microsoft.com/dotnet/api/overview/azure/search.documents-readme) client library, highly recommended for all new projects
49+
3150
## AI Enrichment
3251

33-
This .NET Core console app creates an AI enrichment pipeline consisting of an index, indexer, data source, and skillset. The skillset calls Azure Cognitive Services image analysis, natural language processing, and OCR to extract information and structure from heterogeneous blob content, making it searchable in Azure Cognitive Search.
52+
This .NET Core console app creates an AI enrichment pipeline consisting of an index, indexer, data source, and skillset. The skillset calls Azure Cognitive Services image analysis and OCR, and natural language processing, extract information and structure from heterogeneous blob content, making it searchable in Azure Cognitive Search.
53+
54+
This sample is available in two versions:
55+
56+
+ **v10** uses the previous [Microsoft.Azure.Search](https://docs.microsoft.com/en-us/dotnet/api/overview/azure/search/client10) client libraries
57+
+ **v11** uses the new [Azure.Search.Documents](https://docs.microsoft.com/dotnet/api/overview/azure/search.documents-readme) client library, highly recommended for all new projects

create-first-app/README.md

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,9 @@ In this sample, start with a basic search page layout and then enhance it with p
1818

1919
This MVC sample is featured in [C# tutorial: Create your first app - Azure Cognitive Search](https://docs.microsoft.com/azure/search/tutorial-csharp-create-first-app). It's a collection of projects that demonstrate a user experience using fictitious hotels data. The first project creates a basic search page. Additional projects build on the first, adding results handling, and typeahead. The index is pre-built and hosted so that you can focus on the application itself.
2020

21-
## Contents
22-
23-
| File/folder | Description |
24-
|-------------|-------------|
25-
| `1-basic-search-page` | Initial project providing the page layout. |
26-
| `2a-add-paging` | Adds a vertical scroll bar and page controls |
27-
| `2b-add-infinite-scroll` | Demonstrates an infinite scrolling|
28-
| `3-add-typeahead` | Adds autocomplete query |
29-
| `4-add-facet-navigation` | Adds a facet navigation structure backed by filtering|
30-
| `5-order-results` | Adds results sorting |
31-
| `.gitignore` | Define what to ignore at commit time. |
32-
| `CONTRIBUTING.md` | Guidelines for contributing to the sample. |
33-
| `README.md` | This README file. |
34-
| `LICENSE` | The license for the sample. |
35-
3621
## Prerequisites
3722

38-
- [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/)
23+
- [Visual Studio](https://visualstudio.microsoft.com/downloads/)
3924

4025
In contrast with other tutorials, this one uses a read-only hotels index on an existing demo search service maintained by Microsoft. No preliminary service or index setup is required.
4126

@@ -44,19 +29,28 @@ In contrast with other tutorials, this one uses a read-only hotels index on an e
4429
1. Clone or download this sample repository.
4530
1. Extract contents if the download is a zip file. Make sure the files are read-write.
4631

47-
## Running create-first-app
32+
This sample is available in two versions:
4833

49-
1. Choose which version of the client libraries to work with:
34+
+ **v10** uses the previous [Microsoft.Azure.Search](https://docs.microsoft.com/en-us/dotnet/api/overview/azure/search/client10) client libraries
5035

51-
+ **v10** uses the [Microsoft.Azure.Search](https://docs.microsoft.com/dotnet/api/overview/azure/search/client10) legacy client libraries. With the exception of security bug fixes, there will be no further development in this library. If you have existing search solutions that use this library, use the v10 samples to learn about the APIs.
36+
+ **v11** uses the new [Azure.Search.Documents](https://docs.microsoft.com/dotnet/api/overview/azure/search.documents-readme) client library, highly recommended for all new projects
5237

53-
+ **v11** uses the [Azure.Search.Documents](https://docs.microsoft.com/dotnet/api/overview/azure/search.documents-readme) library, which has been redesigned for consistency with other Azure client libraries. Moving forward, all new features will roll out in this library. If you are new to Cognitive Search, use this version in your search applications.
38+
## Contents
39+
40+
| File/folder | Description |
41+
|-------------|-------------|
42+
| `1-basic-search-page` | Initial project providing the page layout. |
43+
| `2a-add-paging` | Adds a vertical scroll bar and page controls |
44+
| `2b-add-infinite-scroll` | Demonstrates an infinite scrolling|
45+
| `3-add-typeahead` | Adds autocomplete query |
46+
| `4-add-facet-navigation` | Adds a facet navigation structure backed by filtering|
47+
| `5-order-results` | Adds results sorting |
5448

55-
1. Open the first folder: **1-basic-search-page**.
49+
## Run the sample
5650

57-
1. Open the **FirstAzureSearchApp.sln** project in Visual Studio.
51+
1. Open a solution in Visual Studio.
5852

59-
1. Compile and run the project.
53+
1. Press **F5** to compile and run the project.
6054

6155
The solutions in this sample have template modifications. Methods in Startup.cs have been reordered, with app.UseCookiePolicy() relocated below app.UseMvc(...). This change addresses a known issue in .NET Core 2.x MVC apps where TempData is not persisted.
6256

index-backup-restore/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ Also, as an extra precaution, it is best if there are no changes being made to t
2828

2929
**If your index has more than 100,000 documents**, this sample, as written, will not work. This is because the REST API $skip feature, that is used for paging, has a 100K document limit. However, you can work around this limitation by adding code to iterate over, and filter on, a facet with less that 100K documents per facet value.
3030

31-
| File/folder | Description |
32-
|-------------|-------------|
33-
| `AzureSearchBackupRestoreIndex.sln` | .NET Core console solution file |
34-
| `AzureSearchBackupRestoreIndex` | Source files |
35-
| `CONTRIBUTING.md` | Guidelines for contributing to the sample. |
36-
| `README.md` | This README file. |
37-
| `LICENSE` | The license for the sample. |
38-
3931
## Prerequisites
4032

4133
- [Visual Studio](https://visualstudio.microsoft.com/downloads/)
@@ -46,11 +38,18 @@ Also, as an extra precaution, it is best if there are no changes being made to t
4638
1. Clone or download this sample repository.
4739
1. Extract contents if the download is a zip file. Make sure the files are read-write.
4840

49-
### Running the backup-restore application
41+
This sample is available in two versions:
42+
43+
+ **v10** uses the previous [Microsoft.Azure.Search](https://docs.microsoft.com/en-us/dotnet/api/overview/azure/search/client10) client libraries
44+
45+
+ **v11** uses the new [Azure.Search.Documents](https://docs.microsoft.com/dotnet/api/overview/azure/search.documents-readme) client library, highly recommended for all new projects
46+
47+
## Run the sample
5048

5149
[!NOTE] In this application the term "source" identifies the search service and index and that you are backing up. The term "target" identifies the search service and index that will contain the restored (copied) index
5250

5351
1. Open the AzureSearchBackupRestoreIndex.sln project in Visual Studio.
52+
5453
1. By default, this application will copy the source index to the target search service using the target index name you provide.
5554
- If you only want to back up the index and not restore it immediately, do this:
5655
- Comment out the code in the **Main** method after the **BackupIndexAndDocuments** method call.

multiple-data-sources/README.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,9 @@ Demonstrates Azure Cognitive Search indexing from Azure Cosmos DB and Azure Blob
2020

2121
This .NET Core console application is featured in [C# Tutorial: Combine data from multiple data sources in one search index](https://docs.microsoft.com/azure/search/tutorial-multiple-data-sources). When you run the program, a console window emits output messages for each step. This sample runs on an Azure Cognitive Search service, importing content from Azure Cosmos DB and Azure Blob storage, using services and connection information that you provide.
2222

23-
## Contents
24-
25-
| File/folder | Description |
26-
|-------------|-------------|
27-
| `AzureSearchMultipleDataSources.sln` | .NET Core console solution file |
28-
| `src` | Source files |
29-
| `.gitignore` | Define what to ignore at commit time. |
30-
| `CONTRIBUTING.md` | Guidelines for contributing to the sample. |
31-
| `README.md` | This README file. |
32-
| `LICENSE` | The license for the sample. |
33-
3423
## Prerequisites
3524

36-
- [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/)
25+
- [Visual Studio](https://visualstudio.microsoft.com/downloads/)
3726
- [Azure Cognitive Search service](https://docs.microsoft.com/azure/search/search-create-service-portal)
3827
- [Azure Cosmos DB](https://docs.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal)
3928
- [Azure Storage](https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account)
@@ -59,9 +48,15 @@ This .NET Core console application is featured in [C# Tutorial: Combine data fro
5948
+ Select this container, click **Upload**, and then upload all of the JSON files in the *src/blobs* folder, ranging from *Rooms1.json* through *Rooms15.json*. These files contain room details for each of the seven hotels.
6049
+ In the left pane, go to **Settings > Access Keys** and get the connection string for key1. It also goes into the project's *appsettings.json* file.
6150

51+
This sample is available in two versions:
52+
53+
+ **v10** uses the previous [Microsoft.Azure.Search](https://docs.microsoft.com/en-us/dotnet/api/overview/azure/search/client10) client libraries
54+
55+
+ **v11** uses the new [Azure.Search.Documents](https://docs.microsoft.com/dotnet/api/overview/azure/search.documents-readme) client library, highly recommended for all new projects
56+
6257
## Run the sample
6358

64-
1. Open the sample solution in Visual Studio 2019.
59+
1. Open the sample solution in Visual Studio.
6560

6661
1. Edit the *appsettings.json* and fill in the appropriate account names, keys, and connection strings:
6762

optimize-data-indexing/README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ The index is modeled on a subset of the Hotels dataset, reduced for readability
3333
> [!NOTE]
3434
> Network transfer speeds can be a limiting factor when indexing data. You might get a better sense of indexing efficiency if your Visual Studio client is on an [Azure virtual machine](https://azure.microsoft.com/services/virtual-machines/) in the cloud in the same location as Azure Cognitive Search. The [Data Science VM](https://azure.microsoft.com/services/virtual-machines/data-science-virtual-machines/) is a good choice because Visual Studio is preinstalled.
3535
36-
## Contents
37-
38-
| File/folder | Description |
39-
|-------------|-------------|
40-
| `OptimizeDataIndexing.sln` | .NET Core console solution file |
41-
| `OptimizeDataIndexing` | Source files |
42-
| `CONTRIBUTING.md` | Guidelines for contributing to the sample. |
43-
| `README.md` | This README file. |
44-
| `LICENSE` | The license for the sample. |
45-
4636
## Prerequisites
4737

4838
- [Visual Studio](https://visualstudio.microsoft.com/downloads/)
@@ -53,7 +43,13 @@ The index is modeled on a subset of the Hotels dataset, reduced for readability
5343
1. Clone or download this sample repository.
5444
1. Extract contents if the download is a zip file. Make sure the files are read-write.
5545

56-
### Running the solution
46+
This sample is available in two versions.
47+
48+
+ **v10** uses the previous [Microsoft.Azure.Search](https://docs.microsoft.com/en-us/dotnet/api/overview/azure/search/client10) client libraries
49+
50+
+ **v11** uses the new [Azure.Search.Documents](https://docs.microsoft.com/dotnet/api/overview/azure/search.documents-readme) client library, highly recommended for all new projects
51+
52+
## Run the sample
5753

5854
1. Open the OptimizeDataIndexing.sln project in Visual Studio.
5955
1. Update appsetting.json to use your search service name and admin api-key. The admin key is necessary for creating objects and loading data.

0 commit comments

Comments
 (0)