Skip to content

Commit 128c760

Browse files
authored
Merge pull request #2829 from eric-urban/eur/ai-search-qs
split full text quickstart via pivots
2 parents 6810473 + 3777803 commit 128c760

File tree

8 files changed

+134
-108
lines changed

8 files changed

+134
-108
lines changed

articles/search/includes/quickstarts/dotnet.md renamed to articles/search/includes/quickstarts/full-text-csharp.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
---
2-
author: HeidiSteen
3-
ms.author: heidist
2+
manager: nitinme
3+
author: eric-urban
4+
ms.author: eur
45
ms.service: azure-ai-search
5-
ms.custom:
6-
- ignite-2023
76
ms.topic: include
8-
ms.date: 10/07/2024
7+
ms.date: 2/8/2025
98
---
109

10+
[!INCLUDE [Full text introduction](full-text-intro.md)]
11+
1112
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.
1213

1314
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.
1415

15-
#### Set up your environment
16+
## Set up your environment
1617

1718
1. Start Visual Studio and create a new project for a console app.
1819

@@ -24,7 +25,7 @@ Alternatively, you can [download the source code](https://github.com/Azure-Sampl
2425

2526
1. Select **Install** to add the assembly to your project and solution.
2627

27-
#### Create a search client
28+
## Create a search client
2829

2930
1. In *Program.cs*, change the namespace to `AzureSearch.SDK.Quickstart.v11` and then add the following `using` directives.
3031

@@ -58,7 +59,7 @@ Alternatively, you can [download the source code](https://github.com/Azure-Sampl
5859
}
5960
```
6061

61-
#### Create an index
62+
## Create an index
6263

6364
This quickstart builds a Hotels index that you'll load with hotel data and execute queries against. In this step, define the fields in the index. Each field definition includes a name, data type, and attributes that determine how the field is used.
6465

@@ -167,7 +168,7 @@ In this example, synchronous methods of the *Azure.Search.Documents* library are
167168
}
168169
```
169170

170-
#### Load documents
171+
## Load documents
171172

172173
Azure AI 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.
173174

@@ -303,7 +304,7 @@ When uploading documents, you must use an [IndexDocumentsBatch](/dotnet/api/azur
303304

304305
The 2-second delay compensates for indexing, which is asynchronous, so that all documents can be indexed before the queries are executed. Coding in a delay is typically only necessary in demos, tests, and sample applications.
305306

306-
#### Search an index
307+
## Search an index
307308

308309
You can get query results as soon as the first document is indexed, but actual testing of your index should wait until all documents are indexed.
309310

@@ -461,7 +462,7 @@ The previous queries show multiple [ways of matching terms in a query](/azure/se
461462

462463
Full text search and filters are performed using the [SearchClient.Search](/dotnet/api/azure.search.documents.searchclient.search) method. A search query can be passed in the `searchText` string, while a filter expression can be passed in the [Filter](/dotnet/api/azure.search.documents.searchoptions.filter) property of the [SearchOptions](/dotnet/api/azure.search.documents.searchoptions) class. To filter without searching, just pass `"*"` for the `searchText` parameter of the [Search](/dotnet/api/azure.search.documents.searchclient.search) method. To search without filtering, leave the `Filter` property unset, or don't pass in a `SearchOptions` instance at all.
463464

464-
#### Run the program
465+
## Run the program
465466

466467
Press **F5** to rebuild the app and run the program in its entirety.
467468

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
manager: nitinme
3+
author: eric-urban
4+
ms.author: eur
5+
ms.service: azure-ai-search
6+
ms.topic: include
7+
ms.date: 2/8/2025
8+
---
9+
10+
Learn how to use the *Azure.Search.Documents* client library in an Azure SDK to create, load, and query a search index using sample data for [full text search](../../search-lucene-query-architecture.md). Full text search uses Apache Lucene for indexing and queries, and a BM25 ranking algorithm for scoring results.
11+
12+
This quickstart creates and queries a small hotels-quickstart index containing data about 4 hotels.
13+
14+
## Prerequisites
15+
16+
+ An Azure account with an active subscription. You can [create an account for free](https://azure.microsoft.com/pricing/purchase-options/azure-account?icid=azurefreeaccount).
17+
18+
+ An Azure AI Search service. [Create a service](../../search-create-service-portal.md) if you don't have one. You can use a free tier for this quickstart.
19+
20+
+ An API key and service endpoint for your service. Sign in to the [Azure portal](https://portal.azure.com) and [find your search service](https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/CognitiveSearch).
21+
22+
In the **Overview** section, copy the URL and save it to a text editor for a later step. An example endpoint might look like `https://mydemo.search.windows.net`.
23+
24+
In the **Settings** > **Keys** section, copy and save an admin key for full rights to create and delete objects. There are two interchangeable primary and secondary keys. Choose either one.
25+
26+
:::image type="content" source="../../media/search-get-started-rest/get-url-key.png" alt-text="Screenshot that shows the HTTP endpoint and the primary and secondary API key locations.":::

articles/search/includes/quickstarts/java.md renamed to articles/search/includes/quickstarts/full-text-java.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
---
2-
author: HeidiSteen
3-
ms.author: heidist
2+
manager: nitinme
3+
author: eric-urban
4+
ms.author: eur
45
ms.service: azure-ai-search
5-
ms.custom:
6-
- ignite-2023
76
ms.topic: include
8-
ms.date: 01/07/2025
7+
ms.date: 2/8/2025
98
---
109

10+
[!INCLUDE [Full text introduction](full-text-intro.md)]
11+
1112
Build a Java console application using the [Azure.Search.Documents](/java/api/overview/azure/search) library to create, load, and query a search index.
1213

1314
Alternatively, you can [download the source code](https://github.com/Azure-Samples/azure-search-java-samples/tree/main/quickstart) to start with a finished project or follow these steps to create your own.
1415

15-
#### Set up your environment
16+
## Set up your environment
1617

1718
Use the following tools to create this quickstart.
1819

1920
+ [Visual Studio Code with the Java extension](https://code.visualstudio.com/docs/java/extensions)
2021

2122
+ [Java 11 SDK](/java/azure/jdk/)
2223

23-
#### Create the project
24+
## Create the project
2425

2526
1. Start Visual Studio Code.
2627

@@ -56,7 +57,7 @@ Use the following tools to create this quickstart.
5657

5758
1. Open the folder you created the project in.
5859

59-
#### Specify Maven dependencies
60+
## Specify Maven dependencies
6061

6162
1. Open the *pom.xml* file and add the following dependencies.
6263

@@ -88,7 +89,7 @@ Use the following tools to create this quickstart.
8889
<maven.compiler.target>1.11</maven.compiler.target>
8990
```
9091

91-
#### Create a search client
92+
## Create a search client
9293

9394
1. Open the `App` class under **src**, **main**, **java**, **azure**, **search**, **sample**. Add the following import directives.
9495

@@ -137,7 +138,7 @@ Use the following tools to create this quickstart.
137138
}
138139
```
139140

140-
#### Create an index
141+
## Create an index
141142

142143
This quickstart builds a Hotels index that you'll load with hotel data and execute queries against. In this step, define the fields in the index. Each field definition includes a name, data type, and attributes that determine how the field is used.
143144

@@ -324,7 +325,7 @@ Whether you use the basic `SearchField` API or either one of the helper models,
324325
.setSuggesters(new SearchSuggester("sg", Arrays.asList("HotelName"))));
325326
```
326327

327-
#### Load documents
328+
## Load documents
328329

329330
Azure AI 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.
330331

@@ -453,7 +454,7 @@ Once you initialize the `IndexDocumentsBatch` object, you can send it to the ind
453454

454455
The 2-second delay compensates for indexing, which is asynchronous, so that all documents can be indexed before the queries are executed. Coding in a delay is typically only necessary in demos, tests, and sample applications.
455456

456-
#### Search an index
457+
## Search an index
457458

458459
You can get query results as soon as the first document is indexed, but actual testing of your index should wait until all documents are indexed.
459460

@@ -583,7 +584,7 @@ The previous queries show multiple ways of matching terms in a query: full-text
583584

584585
Full text search and filters are performed using the [SearchClient.search](/java/api/com.azure.search.documents.searchclient#com-azure-search-documents-searchclient-search(java-lang-string)) method. A search query can be passed in the `searchText` string, while a filter expression can be passed in the `filter` property of the [SearchOptions](/java/api/com.azure.search.documents.models.searchoptions) class. To filter without searching, just pass "*" for the `searchText` parameter of the `search` method. To search without filtering, leave the `filter` property unset, or don't pass in a `SearchOptions` instance at all.
585586

586-
### Run the program
587+
## Run the program
587588

588589
Press F5 to rebuild the app and run the program in its entirety.
589590

articles/search/includes/quickstarts/javascript.md renamed to articles/search/includes/quickstarts/full-text-javascript.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
---
2-
author: HeidiSteen
3-
ms.author: heidist
2+
manager: nitinme
3+
author: eric-urban
4+
ms.author: eur
45
ms.service: azure-ai-search
5-
ms.custom:
6-
- ignite-2023
76
ms.topic: include
8-
ms.date: 10/07/2024
7+
ms.date: 2/8/2025
98
---
109

10+
[!INCLUDE [Full text introduction](full-text-intro.md)]
11+
1112
Build a Node.js application using the [@azure/search-documents](/javascript/api/overview/azure/search-documents-readme) library to create, load, and query a search index.
1213

1314
Alternatively, you can [download the source code](https://github.com/Azure-Samples/azure-search-javascript-samples/tree/main/quickstart) to start with a finished project or follow these steps to create your own.
1415

15-
#### Set up your environment
16+
## Set up your environment
1617

1718
We used the following tools to create this quickstart.
1819

1920
+ [Visual Studio Code](https://code.visualstudio.com), which has built-in support for creating JavaScript apps
2021

2122
+ [Node.js](https://nodejs.org) and [npm](https://www.npmjs.com)
2223

23-
#### Create the project
24+
## Create the project
2425

2526
1. Start Visual Studio Code.
2627

@@ -84,7 +85,7 @@ We used the following tools to create this quickstart.
8485
8586
Replace the `YOUR-SEARCH-SERVICE-URL` value with the name of your search service endpoint URL. Replace `<YOUR-SEARCH-ADMIN-API-KEY>` with the admin key you recorded earlier.
8687
87-
#### Create index.js file
88+
## Create index.js file
8889
8990
Next we create an *index.js* file, which is the main file that hosts our code.
9091
@@ -127,7 +128,7 @@ main().catch((err) => {
127128

128129
With that in place, we're ready to create an index.
129130

130-
#### Create index
131+
## Create index
131132

132133
Create a file *hotels_quickstart_index.json*. This file defines how Azure AI Search works with the documents you'll be loading in the next step. Each field will be identified by a `name` and have a specified `type`. Each field also has a series of index attributes that specify whether Azure AI Search can search, filter, sort, and facet upon the field. Most of the fields are simple data types, but some, like `AddressType` are complex types that allow you to create rich data structures in your index. You can read more about [supported data types](/rest/api/searchservice/supported-data-types) and index attributes described in [Create Index (REST)](/rest/api/searchservice/indexes/create).
133134

@@ -310,7 +311,7 @@ let index = await indexClient.createIndex(indexDefinition);
310311
console.log(`Index named ${index.name} has been created.`);
311312
```
312313

313-
#### Run the sample
314+
## Run the sample
314315

315316
At this point, you're ready to run the sample. Use a terminal window to run the following command:
316317

@@ -328,7 +329,7 @@ Open the **Overview** of your search service in the Azure portal. Select the **I
328329

329330
In the next step, you'll add data to index.
330331

331-
#### Load documents
332+
## Load documents
332333

333334
In Azure AI Search, documents are data structures that are both inputs to indexing and outputs from queries. You can push such data to the index or use an [indexer](/azure/search/search-indexer-overview). In this case, we'll programatically push the documents to the index.
334335

@@ -458,7 +459,7 @@ To have the program wait for one second, call the `sleep` function like below:
458459
sleep(1000);
459460
```
460461

461-
#### Search an index
462+
## Search an index
462463

463464
With an index created and documents uploaded, you're ready to send queries to the index. In this section, we send five different queries to the search index to demonstrate different pieces of query functionality available to you.
464465

@@ -551,6 +552,6 @@ let documentResult = await searchClient.getDocument(key='3')
551552
console.log(`HotelId: ${documentResult.HotelId}; HotelName: ${documentResult.HotelName}`)
552553
```
553554

554-
#### Run the sample
555+
## Run the sample again
555556

556557
Run the program by using `node index.js`. Now, in addition to the previous steps, the queries are sent and the results written to the console.

articles/search/includes/quickstarts/python.md renamed to articles/search/includes/quickstarts/full-text-python.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
---
2-
author: HeidiSteen
3-
ms.author: heidist
2+
manager: nitinme
3+
author: eric-urban
4+
ms.author: eur
45
ms.service: azure-ai-search
5-
ms.custom:
6-
- ignite-2023
76
ms.topic: include
8-
ms.date: 10/07/2024
7+
ms.date: 2/8/2025
98
---
109

10+
[!INCLUDE [Full text introduction](full-text-intro.md)]
11+
1112
Use a Jupyter notebook and the [azure-search-documents](/python/api/overview/azure/search-documents-readme) library in the Azure SDK for Python to create, load, and query a search index.
1213

1314
Alternatively, you can download and run a [finished notebook](https://github.com/Azure-Samples/azure-search-python-samples/tree/main/Quickstart).
1415

15-
#### Set up your environment
16+
## Set up your environment
1617

1718
Use [Visual Studio Code with the Python extension](https://code.visualstudio.com/docs/languages/python), or an equivalent IDE, with Python 3.10 or later.
1819

@@ -30,7 +31,7 @@ We recommend a virtual environment for this quickstart:
3031

3132
It can take a minute to set up. If you run into problems, see [Python environments in VS Code](https://code.visualstudio.com/docs/python/environments).
3233

33-
#### Install packages and set variables
34+
## Install packages and set variables
3435

3536
1. Install packages, including [azure-search-documents](/python/api/azure-search-documents).
3637

@@ -48,7 +49,7 @@ It can take a minute to set up. If you run into problems, see [Python environmen
4849
index_name: str = "hotels-quickstart"
4950
```
5051

51-
#### Create an index
52+
## Create an index
5253

5354
```python
5455
from azure.core.credentials import AzureKeyCredential
@@ -98,7 +99,7 @@ result = index_client.create_or_update_index(index)
9899
print(f' {result.name} created')
99100
```
100101

101-
#### Create a documents payload
102+
## Create a documents payload
102103

103104
Use an [index action](/python/api/azure-search-documents/azure.search.documents.models.indexaction) for the operation type, such as upload or merge-and-upload. Documents originate from the [HotelsData](https://github.com/Azure-Samples/azure-search-sample-data/blob/main/hotels/HotelsData_toAzureSearch.JSON) sample on GitHub.
104105

@@ -184,7 +185,7 @@ documents = [
184185
]
185186
```
186187

187-
#### Upload documents
188+
## Upload documents
188189

189190
```python
190191
# Upload documents to the index
@@ -201,7 +202,7 @@ except Exception as ex:
201202
endpoint=search_endpoint, credential=credential)
202203
```
203204

204-
#### Run your first query
205+
## Run your first query
205206

206207
Use the *search* method of the [search.client class](/python/api/azure-search-documents/azure.search.documents.searchclient).
207208

@@ -221,7 +222,7 @@ for result in results:
221222
print(f"Description: {result['Description']}")
222223
```
223224

224-
#### Run a term query
225+
## Run a term query
225226

226227
The next query adds whole terms to the search expression ("wifi"). This query specifies that results contain only those fields in the `select` statement. Limiting the fields that come back minimizes the amount of data sent back over the wire and reduces search latency.
227228

@@ -238,7 +239,7 @@ for result in results:
238239
print(f"Description: {result['Description']}")
239240
```
240241

241-
#### Add a filter
242+
## Add a filter
242243

243244
Add a filter expression, returning only those hotels with a rating greater than four, sorted in descending order.
244245

@@ -254,7 +255,7 @@ for result in results:
254255
print("{}: {} - {} rating".format(result["HotelId"], result["HotelName"], result["Rating"]))
255256
```
256257

257-
#### Add field scoping
258+
## Add field scoping
258259

259260
Add `search_fields` to scope query execution to specific fields.
260261

@@ -269,7 +270,7 @@ for result in results:
269270
print("{}: {}".format(result["HotelId"], result["HotelName"]))
270271
```
271272

272-
#### Add facets
273+
## Add facets
273274

274275
Facets are generated for positive matches found in search results. There are no zero matches. If search results don't include the term *wifi*, then *wifi* doesn't appear in the faceted navigation structure.
275276

@@ -283,7 +284,7 @@ for facet in facets["Category"]:
283284
print(" {}".format(facet))
284285
```
285286

286-
#### Look up a document
287+
## Look up a document
287288

288289
Return a document based on its key. This operation is useful if you want to provide drill through when a user selects an item in a search result.
289290

@@ -297,7 +298,7 @@ print("Rating: {}".format(result["Rating"]))
297298
print("Category: {}".format(result["Category"]))
298299
```
299300

300-
#### Add autocomplete
301+
## Add autocomplete
301302

302303
Autocomplete can provide potential matches as the user types into the search box.
303304

0 commit comments

Comments
 (0)