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/includes/quickstarts/search-get-started-vector-python.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -458,7 +458,7 @@ You can add filters, but the filters are applied to the nonvector content in you
458
458
- HotelId: 2, HotelName: Old Century Hotel, Tags: ['pool', 'free wifi', 'air conditioning', 'concierge']
459
459
```
460
460
461
-
The query was the same as the previous [single vector search example](#single-vector-search), but it includes a post-processing exclusion filter and returns only the three hotels that have free Wi-Fi.
461
+
The query was the same as the previous [single vector search example](#single-vector-search), but it includes a post-processing exclusion filter and returns only the two hotels that have free Wi-Fi.
462
462
463
463
1. The next filter example uses a **geo filter**. Run the cell in the section titled "Vector query with a geo filter". This block contains the request to query the search index.
Copy file name to clipboardExpand all lines: articles/search/includes/quickstarts/semantic-ranker-intro.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ ms.topic: include
7
7
ms.date: 06/27/2025
8
8
---
9
9
10
-
In this quickstart, you learn about the index and query modifications that invoke semantic ranker.
10
+
In this quickstart, you learn about the index and query modifications that invoke semantic ranking.
11
11
12
12
In Azure AI Search, [semantic ranking](../../semantic-search-overview.md) is query-side functionality that uses machine reading comprehension from Microsoft to rescore search results, promoting the most semantically relevant matches to the top of the list. Depending on the content and the query, semantic ranking can [significantly improve search relevance](https://techcommunity.microsoft.com/t5/azure-ai-services-blog/azure-cognitive-search-outperforming-vector-search-with-hybrid/ba-p/3929167) with minimal developer effort. Semantic ranking is also required for [agentic retrieval (preview)](../../search-agentic-retrieval-concept.md).
13
13
@@ -16,8 +16,8 @@ You can add a semantic configuration to an existing index with no rebuild requir
16
16
In this quickstart:
17
17
18
18
> [!div class="checklist"]
19
-
> - Add a semantic configuration to a search index
20
-
> - Add semantic parameters to a query
19
+
> + Add a semantic configuration to a search index
20
+
> + Add semantic parameters to a query
21
21
22
22
## Prerequisites
23
23
@@ -31,7 +31,7 @@ In this quickstart:
31
31
32
32
You can connect to your Azure AI Search service [using API keys](../../search-security-api-keys.md) or Microsoft Entra ID with role assignments. Keys are easier to start with, but roles are more secure.
33
33
34
-
To configure the recommended role-based access:
34
+
To configure role-based access:
35
35
36
36
1. Sign in to the [Azure portal](https://portal.azure.com/) and select your search service.
37
37
@@ -45,25 +45,25 @@ To configure the recommended role-based access:
45
45
46
46
1. Select **Add** > **Add role assignment**.
47
47
48
-
1. Assign the **Search Service Contributor** and **Search Index Data Contributor** roles to your user account.
48
+
1. Assign these roles to your user account:
49
+
50
+
+**Search Service Contributor**
51
+
52
+
+**Search Index Data Contributor**
49
53
50
54
For more information, see [Connect to Azure AI Search using roles](../../search-security-rbac.md).
51
55
52
56
## Start with an index
53
57
54
58
This quickstart assumes an existing index, modified to include a semantic configuration. We recommend the [hotels-sample-index](../../search-get-started-portal.md) that you can create in minutes using an Azure portal wizard.
55
59
56
-
If you don't have access to the Azure portal, you can create a hotels-quickstart-index by following the instructions in [Quickstart: Full text search](../../search-get-started-text.md).
57
-
58
-
Both indexes have a "Description" field that's suitable for demonstrating the semantic ranker.
59
-
60
60
1. Sign in to the [Azure portal](https://portal.azure.com/) and find your search service.
61
61
62
-
1. Under **Search management** > **Indexes**, open the hotelsindex. Make sure the index doesn't have a semantic configuration.
62
+
1. Under **Search management** > **Indexes**, open the hotels-sample-index. Make sure the index doesn't have a semantic configuration.
63
63
64
64
:::image type="content" source="../../media/search-get-started-semantic/no-semantic-configuration.png" alt-text="Screenshot of an empty semantic configuration page in the Azure portal.":::
65
65
66
-
1. In **Search explorer**, enter this search string "good trails for running or biking and outdoor activities" so that you can view the response *before* semantic ranking is applied. Your response should be similar to the following example, as scored by the default L1 ranker for full text search. For readability, the example below selects just the "HotelName" and "Description" fields.
66
+
1.To verify the index is operational, run a query. In **Search explorer**, enter this search string "good trails for running or biking and outdoor activities" so that you can view the response *before* semantic ranking is applied. Your response should be similar to the following example, as scored by the default BM25 L1 ranker for full text search. For readability, the example selects just the "HotelName" and "Description" fields.
@@ -23,7 +23,7 @@ We recommend a virtual environment for this quickstart:
23
23
24
24
1. Start Visual Studio Code.
25
25
26
-
1. Open the **semantic-search-quickstart.ipynb** file.
26
+
1. Open the **semantic-search-quickstart.ipynb** file or create a new notebook.
27
27
28
28
1. Open the Command Palette by using **Ctrl+Shift+P**.
29
29
@@ -52,7 +52,7 @@ It can take a minute to set up. If you run into problems, see [Python environmen
52
52
53
53
### Sign in to Azure
54
54
55
-
If you signed in to the [Azure portal](https://portal.azure.com), you're signed into Azure. If you aren't sure, use the Azure CLIor Azure PowerShell to log in: `az login`or`az connect`. If you have multiple tenants and subscriptions, see [Quickstart: Connect without keys](../../search-get-started-rbac/md) forhelp on how to connect.
55
+
If you signed in to the [Azure portal](https://portal.azure.com), you're signed into Azure. If you aren't sure, use the Azure CLIor Azure PowerShell to log in: `az login`or`az connect`. If you have multiple tenants and subscriptions, see [Quickstart: Connect without keys](../../search-get-started-rbac.md) forhelp on how to connect.
56
56
57
57
## Update and query the index
58
58
@@ -136,15 +136,15 @@ result = index_client.create_or_update_index(index)
Add`SemanticConfiguration` to a search index definition. If you're updating an existing index, this modification doesn't require a reindexing because the structure of your documents is unchanged.
168
+
This quickstart demonstrates how to add`SemanticConfiguration` to a search index definition. If you're updating an existing index, this modification doesn't require a reindexing because the structure of your documents is unchanged.
169
169
170
-
Provide the entire schema plus the new `SemanticConfiguration` section. We recommend getting the index schema from the search service to ensure you have a valid schema for the current index. If the schema payload differs in field definitions, the update fails.
170
+
### Index updates
171
171
172
-
This example isthe Python code for the Hotels sample index schema, plus the semantic configuration.
172
+
To update the index, provide the entire schema plus the new `SemanticConfiguration` section. We recommend getting the index schemafrom the search service to ensure you have a valid schema for your update. If the schemas differ in field definitions or are missing other constructs, the update fails.
173
173
174
-
```python
175
-
# Update the search schema, providing the entire schema plus the changes.
Start with an empty query as a verification step, proving that the index is operational. You should get an unordered list of hotel names and descriptions, with a count of 50 indicating that there are fifty documents in the index.
223
-
224
-
```python
225
-
# Run an empty query (returns selected fields, all documents)
For comparison purposes, run a text query withBM25 relevance scoring. Full text search is invoked when you provide a query string. The response consists of ranked results, where higher scores are awarded to documents having more instances of matching terms, or more important terms.
241
-
242
-
In this query for*walk to restaurants and shopping*, Sublime Palace Hotel comes out on top because its description includes *site*. Terms that occur infrequently raise the search score of the document.
243
-
244
-
```python
245
-
# Run a text query (returns a BM25-scored result set)
Output for the top 5 matches for a keyword search should be similar to the following example. The first result contains all three terms: walk, restaurants, shopping.
258
-
259
-
```
260
-
7.9934134
261
-
Foot Happy Suites
262
-
Description: Downtown in the heart of the business district. Close to everything. Leave your car behind and walk to the park, shopping, and restaurants. Or grab one of our bikes and take your explorations a little further.
263
-
6.563842
264
-
Winter Panorama Resort
265
-
Description: Plenty of great skiing, outdoor ice skating, sleigh rides, tubing and snow biking. Yoga, group exercise classes and outdoor hockey are available year-round, plus numerous options for shopping as well as great spa services. Newly-renovated with large rooms, free 24-hr airport shuttle & a new restaurant. Rooms/suites offer mini-fridges &49-inch HDTVs.
266
-
5.8222375
267
-
Uptown Chic Hotel
268
-
Description: Chic hotel near the city. High-rise hotel in downtown, within walking distance to theaters, art galleries, restaurants and shops. Visit Seattle Art Museum by day, and then head over to Benaroya Hall to catch the evening's concert performance.
269
-
4.870869
270
-
Roach Motel
271
-
Description: Perfect Location on Main Street. Earn points while enjoying close proximity to the city's best shopping, restaurants, and attractions.
272
-
4.1960583
273
-
Swirling Currents Hotel
274
-
Description: Spacious rooms, glamorous suites and residences, rooftop pool, walking access to shopping, dining, entertainment and the city center. Each room comes equipped with a microwave, a coffee maker and a minifridge. In-room entertainment includes complimentary W-Fi and flat-screen TVs.
193
+
print(f'{result.name} updated')
275
194
```
276
195
277
-
### Run a semantic query
196
+
### Query parameters
278
197
279
-
Now add semantic ranking. New parameters include `query_type`and`semantic_configuration_name`.
198
+
Required semantic parameters include `query_type`and`semantic_configuration_name`. Optionally, you can add captions to extract portions of the text and apply hit highlighting to the important terms and phrases.
280
199
281
200
```python
282
-
# Runs a semantic query (runs a BM25-ranked query and promotes the most relevant matches to the top)
Output for this query should look similar to the following example. It's the same search string as the previous query, but notice that the semantic ranker elevates the last result in the previous example to first place. Results are ranked by the `rerankerScore` property and results in the 2 category are considered to be of [moderate relevance](../../semantic-search-overview.md#how-ranking-is-scored).
220
+
Output for this query should look similar to the following example. Results are ranked by the `rerankerScore`propertyand results in the 2 category are considered to be of [moderate relevance](../../semantic-search-overview.md#how-ranking-is-scored).
302
221
303
222
```
304
223
2.9116947650909424
@@ -331,7 +250,7 @@ Caption: <em>Sublime Cliff Hotel </em>is located in the heart of the historic ce
331
250
332
251
In this final query, return semantic answers.
333
252
334
-
Semantic ranker can produce an answer to a query string that has the characteristics of a question. The generated answer is extracted verbatim from your content so it won't include composed content like what you get from a chat completion model. If the semantic answer isn't useful for your scenario, you can omit `semantic_answers`from your code.
253
+
Semantic ranker can produce an answer to a query string that has the characteristics of a question. The generated answer is extracted verbatim from your content so it won't include composed content like what you might expect from a chat completion model. If the semantic answer isn't useful for your scenario, you can omit `semantic_answers`from your code.
335
254
336
255
To get a semantic answer, the question and answer must be closely aligned, and the model must find content that clearly answers the question. If potential answers fail to meet a confidence threshold, the model doesn't return an answer. For demonstration purposes, the question in this example is designed to get a response so that you can see the syntax.
0 commit comments