Skip to content

Commit a5ae8c7

Browse files
committed
Intro updates, fixed links
1 parent 513f0c3 commit a5ae8c7

File tree

7 files changed

+133
-1201
lines changed

7 files changed

+133
-1201
lines changed

articles/search/includes/quickstarts/dotnet-semantic.md

Lines changed: 16 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ ms.date: 06/13/2025
1010

1111
[!INCLUDE [Semantic ranker introduction](semantic-ranker-intro.md)]
1212

13-
### CSHARP INCLUDE STARTS HERE
13+
In this quickstart, build a console application by using the [**Azure.Search.Documents**](/dotnet/api/overview/azure/search.documents-readme) client library to add semantic ranking to an existing search index.
1414

15-
Build a console application by using the [**Azure.Search.Documents**](/dotnet/api/overview/azure/search.documents-readme) client library to add semantic ranking to an existing search index.
15+
> [!TIP]
16+
> You can [download the source code](https://github.com/Azure-Samples/azure-search-dotnet-samples/tree/main/quickstart-semantic-search/SemanticSearchQuickstart) to start with a finished project or follow these steps to create your own.
1617
17-
Alternatively, you can [download the source code](https://github.com/Azure-Samples/azure-search-dotnet-samples/tree/main/quickstart-semantic-search/SemanticSearchQuickstart) to start with a finished project.
18+
## Set up the client
1819

19-
#### Set up your environment
20+
In this quickstart, you use an IDE and the [Azure.Search.Documents](TBD) library to configure and use a semantic ranker.
21+
22+
We recommend [Visual Studio](TBD) for this quickstart.
23+
24+
### Install libraries
2025

2126
1. Start Visual Studio and create a new project for a console app.
2227

@@ -28,7 +33,7 @@ Alternatively, you can [download the source code](https://github.com/Azure-Sampl
2833

2934
1. Select **Install** to add the assembly to your project and solution.
3035

31-
#### Create a search client
36+
### Create a search client
3237

3338
1. In *Program.cs*, add the following `using` directives.
3439

@@ -40,7 +45,7 @@ Alternatively, you can [download the source code](https://github.com/Azure-Sampl
4045
using Azure.Search.Documents.Models;
4146
```
4247

43-
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.
48+
1. Create two clients: [SearchIndexClient](/dotnet/api/azure.search.documents.indexes.searchindexclient) to update the index, and [SearchClient](/dotnet/api/azure.search.documents.searchclient) to query an index.
4449

4550
Both clients need the service endpoint and an admin API key for authentication with create/delete rights. However, the code builds out the URI for you, so specify only the search service name for the `serviceName` property. Don't include `https://` or `.search.windows.net`.
4651

@@ -63,60 +68,13 @@ Alternatively, you can [download the source code](https://github.com/Azure-Sampl
6368
}
6469
```
6570

66-
#### Create an index
67-
68-
Create or update an index schema to include a `SemanticConfiguration`. If you're updating an existing index, this modification doesn't require a reindexing because the structure of your documents is unchanged.
69-
70-
```csharp
71-
// Create hotels-quickstart index
72-
private static void CreateIndex(string indexName, SearchIndexClient adminClient)
73-
{
74-
75-
FieldBuilder fieldBuilder = new FieldBuilder();
76-
var searchFields = fieldBuilder.Build(typeof(Hotel));
77-
78-
var definition = new SearchIndex(indexName, searchFields);
79-
var suggester = new SearchSuggester("sg", new[] { "HotelName", "Category", "Address/City", "Address/StateProvince" });
80-
definition.Suggesters.Add(suggester);
81-
definition.SemanticSearch = new SemanticSearch
82-
{
83-
Configurations =
84-
{
85-
new SemanticConfiguration("semantic-config", new()
86-
{
87-
TitleField = new SemanticField("HotelName"),
88-
ContentFields =
89-
{
90-
new SemanticField("Description"),
91-
},
92-
KeywordsFields =
93-
{
94-
new SemanticField("Tags"),
95-
new SemanticField("Category")
96-
}
97-
})
98-
}
99-
};
100-
101-
adminClient.CreateOrUpdateIndex(definition);
102-
}
103-
```
104-
105-
The following code creates the index on your search service:
106-
107-
```csharp
108-
// Create index
109-
Console.WriteLine("{0}", "Creating index...\n");
110-
CreateIndex(indexName, adminClient);
111-
112-
SearchClient ingesterClient = adminClient.GetSearchClient(indexName);
113-
```
71+
## Add semantic configuration to an index
11472

115-
#### Load documents
73+
TBD
11674

117-
Azure AI Search searches over content stored in the service. The code for uploading documents is identical to the [C# quickstart for full text search](/azure/search/search-get-started-text) so we don't need to duplicate it here. You should have four hotels with names, addresses, and descriptions. Your solution should have types for Hotels and Addresses.
75+
## Search with semantic reranking
11876

119-
#### Search an index
77+
TBD
12078

12179
Here's a query that invokes semantic ranker, with search options for specifying parameters:
12280

@@ -149,7 +107,7 @@ In contrast, when semantic ranking is applied to the same query ("restaurant on
149107

150108
:::image type="content" source="../../media/quickstart-semantic/semantic-ranking.png" alt-text="Screenshot showing matches ranked based on semantic ranking.":::
151109

152-
#### Run the program
110+
### Run the program
153111

154112
Press F5 to rebuild the app and run the program in its entirety.
155113

articles/search/includes/quickstarts/python-semantic.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ ms.date: 06/13/2025
1010

1111
[!INCLUDE [Semantic ranker introduction](semantic-ranker-intro.md)]
1212

13-
### PYTHON INCLUDE STARTS HERE
13+
> [!TIP]
14+
> You can [download and run a finished notebook](https://github.com/Azure-Samples/azure-search-python-samples/tree/main/Quickstart-Semantic-Search) to start with a finished project or follow these steps to create your own.
1415
15-
Use a Jupyter notebook and the [**azure-search-documents**](/python/api/overview/azure/search-documents-readme) library in the Azure SDK for Python to learn about semantic ranking.
16+
## Set up the client
1617

17-
Alternatively, you can [download and run a finished notebook](https://github.com/Azure-Samples/azure-search-python-samples/tree/main/Quickstart-Semantic-Search).
18-
19-
#### Set up your environment
18+
In this quickstart, use a Jupyter notebook and the [**azure-search-documents**](/python/api/overview/azure/search-documents-readme) library in the Azure SDK for Python to learn about semantic ranking.
2019

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

@@ -36,7 +35,7 @@ We recommend a virtual environment for this quickstart:
3635

3736
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).
3837

39-
#### Install packages and set variables
38+
### Install packages and set variables
4039

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

@@ -54,7 +53,7 @@ It can take a minute to set up. If you run into problems, see [Python environmen
5453
index_name: str = "hotels-quickstart"
5554
```
5655

57-
#### Create an index
56+
### Create or update an index
5857

5958
Create or update an index schema to include a `SemanticConfiguration`. If you're updating an existing index, this modification doesn't require a reindexing because the structure of your documents is unchanged.
6059

@@ -118,7 +117,7 @@ result = index_client.create_or_update_index(index)
118117
print(f' {result.name} created')
119118
```
120119

121-
#### Create a documents payload
120+
### Create a documents payload
122121

123122
You can push JSON documents to a search index. Documents must match the index schema.
124123

@@ -199,7 +198,7 @@ documents = [
199198
]
200199
```
201200

202-
#### Upload documents to the index
201+
### Upload documents to the index
203202

204203
```python
205204
search_client = SearchClient(endpoint=search_endpoint,
@@ -234,7 +233,7 @@ for result in results:
234233
print(f"Description: {result['Description']}")
235234
```
236235

237-
#### Run a text query
236+
### Run a text query
238237

239238
For comparison purposes, run a text query with BM25 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.
240239

@@ -253,7 +252,7 @@ for result in results:
253252
print(f"Description: {result['Description']}")
254253
```
255254

256-
#### Run a semantic query
255+
### Run a semantic query
257256

258257
Now add semantic ranking. New parameters include `query_type` and `semantic_configuration_name`.
259258

@@ -279,7 +278,7 @@ for result in results:
279278
print(f"Caption: {caption.text}\n")
280279
```
281280

282-
#### Return semantic answers
281+
### Return semantic answers
283282

284283
In this final query, return semantic answers.
285284

articles/search/includes/quickstarts/semantic-ranker-intro.md

Lines changed: 94 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,108 @@ ms.date: 06/25/2025
99

1010
In this quickstart, you learn about the index and query modifications that invoke semantic ranker.
1111

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).
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).
1313

14-
You can add a semantic configuration to an existing index with no rebuild requirement. Semantic ranking is effective on content that's informational or descriptive.
14+
You can add a semantic configuration to an existing index with no rebuild requirement. Semantic ranking is most effective on content that's informational or descriptive.
15+
16+
In this quickstart:
17+
18+
> [!div class="checklist"]
19+
> - Add a *semantic configuration* to a search index
20+
> - Add semantic parameters to a query
1521
1622
## Prerequisites
1723

1824
+ An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
1925

20-
+ An [Azure AI Search service](search-create-service-portal.md), at Basic tier or higher, with [semantic ranker enabled](semantic-how-to-enable-disable.md).
26+
+ An [Azure AI Search service](../../search-create-service-portal.md), at Basic tier or higher, with [semantic ranker enabled](semantic-how-to-enable-disable.md).
27+
28+
+ A [new or existing index](../../search-how-to-create-search-index.md) with descriptive or verbose text fields, attributed as retrievable in your index.
29+
30+
## Configure role-based access
31+
32+
TBD
33+
34+
## Start with an index
35+
36+
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.
37+
38+
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).
39+
40+
Both indexes have a "Description" field that's suitable for demonstrating the semantic ranker.
41+
42+
1. Sign in to the Azure portal and find your search service.
43+
44+
1. Under **Search management** > **Indexes**, open the hotels index. Make sure the index doesn't have a semantic configuration.
2145

22-
+ A [new or existing index](search-how-to-create-search-index.md) with descriptive or verbose text fields, attributed as retrievable in your index.
46+
:::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.":::
2347

24-
## How to add a semantic ranker
48+
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.
2549

26-
To use semantic ranker, add a *semantic configuration* to a search index, and add parameters to a query. If you have an existing index, you can make these changes without having to reindex your content because there's no impact on the structure of your searchable content.
50+
```json
51+
"@odata.count": 11,
52+
"value": [
53+
{
54+
"@search.score": 3.5593667,
55+
"HotelName": "Winter Panorama Resort",
56+
"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."
57+
},
58+
{
59+
"@search.score": 3.0720026,
60+
"HotelName": "Good Business Hotel",
61+
"Description": "1 Mile from the airport. Free WiFi, Outdoor Pool, Complimentary Airport Shuttle, 6 miles from Lake Lanier & 10 miles from downtown. Our business center includes printers, a copy machine, fax, and a work area."
62+
},
63+
{
64+
"@search.score": 2.2779887,
65+
"HotelName": "Trails End Motel",
66+
"Description": "Only 8 miles from Downtown. On-site bar/restaurant, Free hot breakfast buffet, Free wireless internet, All non-smoking hotel. Only 15 miles from airport."
67+
},
68+
{
69+
"@search.score": 1.7617674,
70+
"HotelName": "Royal Cottage Resort",
71+
"Description": "Your home away from home. Brand new fully equipped premium rooms, fast WiFi, full kitchen, washer & dryer, fitness center. Inner courtyard includes water features and outdoor seating. All units include fireplaces and small outdoor balconies. Pets accepted."
72+
},
73+
{
74+
"@search.score": 1.5327098,
75+
"HotelName": "City Center Summer Wind Resort",
76+
"Description": "Eco-friendly from our gardens to table, with a rooftop serenity pool and outdoor seating to take in the sunset. Just steps away from the Convention Center. Located in the heart of downtown with modern rooms with stunning city views, 24-7 dining options, free WiFi and easy valet parking."
77+
},
78+
{
79+
"@search.score": 1.5104222,
80+
"HotelName": "Foot Happy Suites",
81+
"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."
82+
},
83+
{
84+
"@search.score": 1.4453387,
85+
"HotelName": "Economy Universe Motel",
86+
"Description": "Local, family-run hotel in bustling downtown Redmond. We are a pet-friendly establishment, near expansive Marymoor park, haven to pet owners, joggers, and sports enthusiasts. Close to the highway and just a short drive away from major cities."
87+
},
88+
{
89+
"@search.score": 1.3732712,
90+
"HotelName": "Starlight Suites",
91+
"Description": "Complimentary Airport Shuttle & WiFi. Book Now and save - Spacious All Suite Hotel, Indoor Outdoor Pool, Fitness Center, Florida Green certified, Complimentary Coffee, HDTV"
92+
},
93+
{
94+
"@search.score": 1.2054883,
95+
"HotelName": "Happy Lake Resort & Restaurant",
96+
"Description": "The largest year-round resort in the area offering more of everything for your vacation – at the best value! What can you enjoy while at the resort, aside from the mile-long sandy beaches of the lake? Check out our activities sure to excite both young and young-at-heart guests. We have it all, including being named “Property of the Year” and a “Top Ten Resort” by top publications."
97+
},
98+
{
99+
"@search.score": 1.161385,
100+
"HotelName": "White Mountain Lodge & Suites",
101+
"Description": "Live amongst the trees in the heart of the forest. Hike along our extensive trail system. Visit the Natural Hot Springs, or enjoy our signature hot stone massage in the Cathedral of Firs. Relax in the meditation gardens, or join new friends around the communal firepit. Weekend evening entertainment on the patio features special guest musicians or poetry readings."
102+
},
103+
{
104+
"@search.score": 0.8955848,
105+
"HotelName": "Windy Ocean Motel",
106+
"Description": "Oceanfront hotel overlooking the beach features rooms with a private balcony and 2 indoor and outdoor pools. Inspired by the natural beauty of the island, each room includes an original painting of local scenes by the owner. Rooms include a mini fridge, Keurig coffee maker, and flatscreen TV. Various shops and art entertainment are on the boardwalk, just steps away."
107+
}
108+
]
109+
}
110+
```
27111

28-
+ A semantic configuration sets a priority order for fields that contribute a title, keywords, and content used in semantic reranking. Field prioritization allows for faster processing.
112+
Later, you can try this query again after semantic ranking is configured to see how the response changes.
29113

30-
+ Queries that invoke semantic ranker include parameters for query type and whether captions and answers are returned. You can add these parameters to your existing query logic. There's no conflict with other parameters.
114+
> [!TIP]
115+
> You can add a semantic configuration in the Azure portal. However, if you want to learn how to add a semantic configuration programmatically, continue with the instructions in this quickstart.
116+
>

0 commit comments

Comments
 (0)