Skip to content

Commit 2dca0f0

Browse files
committed
more formatting fixes
1 parent c433e84 commit 2dca0f0

File tree

3 files changed

+76
-76
lines changed

3 files changed

+76
-76
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ ms.date: 07/03/2025
1010

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

13-
> [!TIP]
14-
> 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.
15-
1613
## Set up the client
1714

1815
In this quickstart, you use an IDE and the [**Azure.Search.Documents**](/dotnet/api/overview/azure/search.documents-readme) client library to add semantic ranking to an existing search index.
1916

2017
We recommend [Visual Studio](https://visualstudio.microsoft.com/vs/community/) for this quickstart.
2118

19+
> [!TIP]
20+
> 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.
21+
2222
### Install libraries
2323

2424
1. Start Visual Studio and open the [quickstart-semantic-search.sln](https://github.com/Azure-Samples/azure-search-dotnet-samples/tree/main/quickstart-semantic-search) or create a new project using a console application template.

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

Lines changed: 62 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ ms.date: 07/03/2025
1010

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

13-
> [!TIP]
14-
> You can [download 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.
15-
1613
## Set up the client
1714

1815
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.
1916

2017
We recommend [Visual Studio Code](https://code.visualstudio.com/download) with Python 3.10 or later and the [Python extension](https://code.visualstudio.com/docs/languages/python) for this quickstart.
2118

19+
> [!TIP]
20+
> You can [download 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.
21+
2222
We recommend a virtual environment for this quickstart:
2323

2424
1. Start Visual Studio Code.
@@ -122,73 +122,72 @@ In this section, you update a search index to include a semantic configuration.
122122

123123
1. Add a semantic configuration to an existing hotels-sample-index on your search service. No search documents are deleted by this operation and your index is still operational after the configuration is added.
124124

125-
```python
126-
# Add semantic configuration to hotels-sample-index and display updated index details
127-
from azure.search.documents.indexes.models import (
128-
SemanticConfiguration,
129-
SemanticField,
130-
SemanticPrioritizedFields,
131-
SemanticSearch
132-
)
133-
134-
try:
135-
# Get the existing index
136-
existing_index = index_client.get_index(index_name)
137-
138-
# Create a new semantic configuration
139-
new_semantic_config = SemanticConfiguration(
140-
name="semantic-config",
141-
prioritized_fields=SemanticPrioritizedFields(
142-
title_field=SemanticField(field_name="HotelName"),
143-
keywords_fields=[SemanticField(field_name="Tags")],
144-
content_fields=[SemanticField(field_name="Description")]
145-
)
125+
```python
126+
# Add semantic configuration to hotels-sample-index and display updated index details
127+
from azure.search.documents.indexes.models import (
128+
SemanticConfiguration,
129+
SemanticField,
130+
SemanticPrioritizedFields,
131+
SemanticSearch
146132
)
147133

148-
# Add semantic configuration to the index
149-
if existing_index.semantic_search is None:
150-
existing_index.semantic_search = SemanticSearch(configurations=[new_semantic_config])
151-
else:
152-
# Check if configuration already exists
153-
config_exists = any(config.name == "semantic-config"
154-
for config in existing_index.semantic_search.configurations)
155-
if not config_exists:
156-
existing_index.semantic_search.configurations.append(new_semantic_config)
157-
158-
# Update the index
159-
result = index_client.create_or_update_index(existing_index)
160-
161-
# Get the updated index and display detailed information
162-
updated_index = index_client.get_index(index_name)
163-
164-
print("Semantic configurations:")
165-
print("-" * 40)
166-
if updated_index.semantic_search and updated_index.semantic_search.configurations:
167-
for config in updated_index.semantic_search.configurations:
168-
print(f" Configuration: {config.name}")
169-
if config.prioritized_fields.title_field:
170-
print(f" Title field: {config.prioritized_fields.title_field.field_name}")
171-
if config.prioritized_fields.keywords_fields:
172-
keywords = [kf.field_name for kf in config.prioritized_fields.keywords_fields]
173-
print(f" Keywords fields: {', '.join(keywords)}")
174-
if config.prioritized_fields.content_fields:
175-
content = [cf.field_name for cf in config.prioritized_fields.content_fields]
176-
print(f" Content fields: {', '.join(content)}")
177-
print()
178-
else:
179-
print(" No semantic configurations found")
180-
181-
print("✅ Semantic configuration successfully added!")
134+
try:
135+
# Get the existing index
136+
existing_index = index_client.get_index(index_name)
137+
138+
# Create a new semantic configuration
139+
new_semantic_config = SemanticConfiguration(
140+
name="semantic-config",
141+
prioritized_fields=SemanticPrioritizedFields(
142+
title_field=SemanticField(field_name="HotelName"),
143+
keywords_fields=[SemanticField(field_name="Tags")],
144+
content_fields=[SemanticField(field_name="Description")]
145+
)
146+
)
147+
148+
# Add semantic configuration to the index
149+
if existing_index.semantic_search is None:
150+
existing_index.semantic_search = SemanticSearch(configurations=[new_semantic_config])
151+
else:
152+
# Check if configuration already exists
153+
config_exists = any(config.name == "semantic-config"
154+
for config in existing_index.semantic_search.configurations)
155+
if not config_exists:
156+
existing_index.semantic_search.configurations.append(new_semantic_config)
157+
158+
# Update the index
159+
result = index_client.create_or_update_index(existing_index)
160+
161+
# Get the updated index and display detailed information
162+
updated_index = index_client.get_index(index_name)
163+
164+
print("Semantic configurations:")
165+
print("-" * 40)
166+
if updated_index.semantic_search and updated_index.semantic_search.configurations:
167+
for config in updated_index.semantic_search.configurations:
168+
print(f" Configuration: {config.name}")
169+
if config.prioritized_fields.title_field:
170+
print(f" Title field: {config.prioritized_fields.title_field.field_name}")
171+
if config.prioritized_fields.keywords_fields:
172+
keywords = [kf.field_name for kf in config.prioritized_fields.keywords_fields]
173+
print(f" Keywords fields: {', '.join(keywords)}")
174+
if config.prioritized_fields.content_fields:
175+
content = [cf.field_name for cf in config.prioritized_fields.content_fields]
176+
print(f" Content fields: {', '.join(content)}")
177+
print()
178+
else:
179+
print(" No semantic configurations found")
180+
181+
print("✅ Semantic configuration successfully added!")
182+
183+
except Exception as ex:
184+
print(f"❌ Error adding semantic configuration: {ex}")
185+
```
182186

183-
except Exception as ex:
184-
print(f"❌ Error adding semantic configuration: {ex}")
185-
```
186-
187187
1. Run the code.
188188

189189
1. Output is the semantic configuration you just added.
190190

191-
192191
## Run semantic queries
193192

194193
Once the index has a semantic configuration, you can run queries that include semantic parameters.

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ ms.date: 07/03/2025
99

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

12-
> [!TIP]
13-
> You can [download the source code](https://github.com/Azure-Samples/azure-search-rest-samples/tree/main/Quickstart-semantic-search) to start with a finished project or follow these steps to create your own.
14-
1512
## Set up the client
1613

1714
In this quickstart, you use a REST client and the [Azure AI Search REST APIs](/rest/api/searchservice) to configure and use a semantic ranker.
1815

1916
We recommend [Visual Studio Code](https://code.visualstudio.com/download) with a [REST client extension](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) for this quickstart.
2017

18+
> [!TIP]
19+
> You can [download the source code](https://github.com/Azure-Samples/azure-search-rest-samples/tree/main/Quickstart-semantic-search) to start with a finished project or follow these steps to create your own.
20+
2121
1. Start Visual Studio Code and open the [semantic-search-index-update.rest](https://github.com/Azure-Samples/azure-search-rest-samples/blob/main/Quickstart-semantic-search/semantic-search-index-update.rest) file or create a new file.
2222

2323
1. At the top, set environment variables for your search service, authorization, and index name.
@@ -26,18 +26,20 @@ We recommend [Visual Studio Code](https://code.visualstudio.com/download) with a
2626

2727
+ For @personalAccessToken, follow the instructions in [Connect without keys](../../search-get-started-rbac.md) to get your personal access token.
2828

29-
1. To test the connection, send your first request.
30-
31-
:::image type="content" source="../../media/search-get-started-semantic/visual-studio-code-send-request.png" alt-text="Screenshot of the REST client send request link.":::
32-
33-
This GET request returns a list of existing indexes. You should get an HTTP 200 Success status code and a list of indexes, including hotels-sample-index used in this quickstart.
29+
1. To test the connection, send your first request.
3430

3531
```http
3632
### List existing indexes by name (verify the connection)
3733
GET {{searchUrl}}/indexes?api-version=2025-05-01-preview&$select=name HTTP/1.1
3834
Authorization: Bearer {{personalAccessToken}}
3935
```
4036

37+
1. Select **Sent request**.
38+
39+
:::image type="content" source="../../media/search-get-started-semantic/visual-studio-code-send-request.png" alt-text="Screenshot of the REST client send request link.":::
40+
41+
1. Output for this GET request returns a list of existing indexes. You should get an HTTP 200 Success status code and a list of indexes, including hotels-sample-index used in this quickstart.
42+
4143
## Update the index
4244

4345
To update an index using the REST API, you must provide the entire schema, plus the modifications you want to make. This request provides hotels-sample-index schema, plus the semantic configuration. The modification consists of the following JSON.
@@ -59,8 +61,7 @@ To update an index using the REST API, you must provide the entire schema, plus
5961
}
6062
```
6163

62-
The full POST request specifies the index name, operation, and full JSON schema. All required elements of the schema must be present. For this task, we recommend a GET to return the schema, and then adding your modifications.
63-
64+
The full POST request specifies the index name, operation, and full JSON schema. All required elements of the schema must be present. This request includes the full schema for hotels-sample-index plus the semantic configuration.
6465
```http
6566
POST {{searchUrl}}/indexes?api-version=2025-05-01-preview HTTP/1.1
6667
Content-Type: application/json

0 commit comments

Comments
 (0)