Skip to content

Commit 498b3c8

Browse files
committed
Corrected references to k for semantic queries
1 parent 2753a41 commit 498b3c8

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

articles/search/hybrid-search-how-to-query.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ POST https://{{search-service-name}}.search.windows.net/indexes/{{index-name}}/d
228228

229229
Assuming that you [enabled semantic ranker](semantic-how-to-enable-disable.md) and your index definition includes a [semantic configuration](semantic-how-to-query-request.md), you can formulate a query that includes vector search and keyword search, with semantic ranking over the merged result set. Optionally, you can add captions and answers.
230230

231+
Whenever you use semantic ranking with vectors, make sure `k` is set to 50. Semantic ranker uses up to 50 matches as input. Specifying less than 50 deprives the semantic ranking models of necessary inputs.
232+
231233
```http
232234
POST https://{{search-service-name}}.search.windows.net/indexes/{{index-name}}/docs/search?api-version=2024-07-01
233235
Content-Type: application/json
@@ -306,7 +308,7 @@ api-key: {{admin-api-key}}
306308

307309
+ Prefiltering is applied before query execution. If prefilter reduces the search area to 100 documents, the vector query executes over the "DescriptionVector" field for those 100 documents, returning the k=50 best matches. Those 50 matching documents then pass to RRF for merged results, and then to semantic ranker.
308310

309-
+ Postfilter is applied after query execution. If k=50 returns 50 matches on the vector query side, then the post-filter is applied to the 50 matches, reducing results that meet filter criteria, leaving you with fewer than 50 documents to pass to semantic ranker.
311+
+ Postfilter is applied after query execution. If k=50 returns 50 matches on the vector query side, followed by a post-filter applied to the 50 matches, your results are reduced by the number of document that meet filter criteria. This leaves you with fewer than 50 documents to pass to semantic ranker. Keep this in mind if you're using semantic ranking. The semantic ranker works best if it has 50 documents as input.
310312

311313
## Set maxTextRecallSize and countAndFacetMode (preview)
312314

articles/search/semantic-code-migration.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ ms.date: 12/10/2024
1414

1515
# Migrate semantic ranking code from previous versions
1616

17-
If your semantic ranking code was written against preview APIs, this article explains how to migrate to newer APIs. Breaking changes for semantic ranker are limited to query logic in recent APIs, but if your code was written against the initial preview version, you might need to change your semantic configuration as well.
17+
If your semantic ranking code was written against early preview APIs, this article identifies the code changes necessary for migrating to newer API versions. Breaking changes for semantic ranker are limited to query logic in recent APIs, but if your code was written against the initial preview version, you might need to change your semantic configuration as well.
1818

1919
## Breaking changes
2020

2121
There are two breaking changes for semantic ranker across REST API versions:
2222

23-
+ `searchFields` replaced by `semanticConfiguration` in 2021-04-30-preview
24-
+ `queryLanguage` ignored in 2023-07-01-preview, but reinstated for query rewrite in 2024-11-01-preview
23+
+ `searchFields` was replaced by `semanticConfiguration` in 2021-04-30-preview
24+
+ `queryLanguage` was ignored starting in 2023-07-01-preview, but reinstated for query rewrite in 2024-11-01-preview
2525

2626
Other version-specific updates pertain to new capabilities, but don't break existing code and are therefore not breaking changes.
2727

@@ -41,11 +41,11 @@ Check your code for the REST API version or SDK package version to confirm which
4141
| preview | [2024-05-01-preview](/rest/api/searchservice/operation-groups?view=rest-searchservice-2024-05-01-preview&preserve-view=true) | No change |
4242
| stable | [2024-07-01](/rest/api/searchservice/indexes/create-or-update?view=rest-searchservice-2024-07-01&preserve-view=true) | No change |
4343
| preview | [2024-09-01-preview](/rest/api/searchservice/operation-groups?view=rest-searchservice-2024-09-01-preview&preserve-view=true) | No change |
44-
| preview | [2024-11-01-preview](/rest/api/searchservice/operation-groups?view=rest-searchservice-2024-11-01-preview&preserve-view=true) | Adds query rewrite. The `queryLanguage` property is now required if you use [query rewrite (preview)](semantic-how-to-query-rewrite.md). For a list of valid values, see the [REST API](/rest/api/searchservice/documents/search-post?view=rest-searchservice-2024-11-01-preview#querylanguage&preserve-view=true). |
44+
| preview | [2024-11-01-preview](/rest/api/searchservice/operation-groups?view=rest-searchservice-2024-11-01-preview&preserve-view=true) | Adds query rewrite. The `queryLanguage` property is now required if you use [query rewrite (preview)](semantic-how-to-query-rewrite.md). |
4545

4646
## Change logs for Azure SDKs
4747

48-
Azure SDKs are on an independent release schedule. You should check the change logs to determine which packages provide semantic features.
48+
Azure SDKs are on an independent release schedule. You should check the change logs to determine which packages provide semantic features and whether any APIs have been renamed.
4949

5050
+ [Azure SDK for .NET change log](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Search.Documents_11.5.1/sdk/search/Azure.Search.Documents/CHANGELOG.md#1150-2023-11-10&preserve-view=true)
5151
+ [Azure SDK for Python change log](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/CHANGELOG.md#1140-2023-10-13&preserve-view=true)
@@ -55,7 +55,7 @@ Azure SDKs are on an independent release schedule. You should check the change l
5555
## 2024-11-01-preview
5656

5757
+ Adds [query rewrite](semantic-how-to-query-rewrite.md) to Search Documents.
58-
+ Requires `queryLanguage` for query rewrite workloads.
58+
+ Requires `queryLanguage` for query rewrite workloads. For a list of valid values, see the [REST API](/rest/api/searchservice/documents/search-post?view=rest-searchservice-2024-11-01-preview#querylanguage&preserve-view=true).
5959

6060
## 2024-09-01-preview
6161

@@ -73,7 +73,7 @@ No changes to semantic ranking syntax from the 2024-03-01-preview version.
7373

7474
## 2024-03-01-preview
7575

76-
No changes to semantic ranking syntax from the 2023-10-01-preview version, but vector queries are introduced. Semantic ranking now applies to responses from hybrid and vector queries, apply reranking on any human-readable text fields in the response.
76+
No changes to semantic ranking syntax from the 2023-10-01-preview version, but vector queries are introduced. Semantic ranking now applies to responses from hybrid and vector queries. You can apply reranking on any human-readable text fields in the response, assuming the fields are listed in `prioritizedFields`.
7777

7878
## 2023-11-01
7979

@@ -95,9 +95,9 @@ Starting on July 14, 2023, semantic ranker is language agnostic. In preview vers
9595

9696
+ Semantic support is through [Search Documents](/rest/api/searchservice/preview-api/search-documents) and [Create or Update Index](/rest/api/searchservice/preview-api/create-or-update-index) preview API calls.
9797
+ Adds `semanticConfiguration` to a search index. A semantic configuration has a name and a prioritized field list.
98-
+ Adds `semanticFields`.
98+
+ Adds ``prioritizedFields`.
9999

100-
The `searchFields` property is no longer used to prioritize fields. In all versions moving forward, `semanticConfiguration.semanticFields` replaces `searchFields` as the mechanism for specifying which fields to use for L2 ranking.
100+
The `searchFields` property is no longer used to prioritize fields. In all versions moving forward, `semanticConfiguration.prioritizedFields` replaces `searchFields` as the mechanism for specifying which fields to use for L2 ranking.
101101

102102
## 2020-06-30-preview
103103

articles/search/vector-search-how-to-query.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,18 +400,20 @@ api-key: {{admin-api-key}}
400400
"kind": "text",
401401
"text": "mystery novel set in London",
402402
"fields": "descriptionVector, synopsisVector",
403-
"k": 5
403+
"k": 50
404404
},
405405
{
406406
"kind": "text"
407407
"text": "living english author",
408408
"fields": "authorBioVector",
409-
"k": 5
409+
"k": 50
410410
}
411411
]
412412
}
413413
```
414414

415+
Whenever you use semantic ranking with vectors, make sure `k` is set to 50. Semantic ranker uses up to 50 matches as input. Specifying less than 50 deprives the semantic ranking models of necessary inputs.
416+
415417
The scored results from all four queries are fused using [RRF ranking](hybrid-search-ranking.md). Secondary [semantic ranking](semantic-search-overview.md) is invoked over the fused search results, but on the `searchFields` only, boosting results that are the most semantically aligned to `"search":"mystery novel set in London"`.
416418

417419
> [!NOTE]

0 commit comments

Comments
 (0)