|
| 1 | +--- |
| 2 | +title: Migrate semantic ranking code |
| 3 | +titleSuffix: Azure AI Search |
| 4 | +description: Migrate semantic ranking code from preview to stable versions, and now to newer preview versions. |
| 5 | +manager: nitinme |
| 6 | +author: HeidiSteen |
| 7 | +ms.author: heidist |
| 8 | +ms.service: azure-ai-search |
| 9 | +ms.custom: |
| 10 | + - ignite-2023 |
| 11 | +ms.topic: how-to |
| 12 | +ms.date: 12/10/2024 |
| 13 | +--- |
| 14 | + |
| 15 | +# Migrate semantic ranking code from previous versions |
| 16 | + |
| 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, you might need to change your semantic configuration as well. |
| 18 | + |
| 19 | +## API versions providing semantic ranking |
| 20 | + |
| 21 | +Check your code for the REST API version or SDK package version to confirm which one provides semantic ranking. The following API versions have some level of support for semantic ranking. |
| 22 | + |
| 23 | +| Release | REST API version | |
| 24 | +|--|--| |
| 25 | +| initial | 2020-06-30-preview (query only) | |
| 26 | +| preview | 2021-04-30-preview (adds semantic configuration) | |
| 27 | +| preview | 2023-07-01-preview (changes semantic configuration <sup>1</sup>) | |
| 28 | +| preview | 2023-10-01-preview (changes semantic configuration <sup>2</sup>) | |
| 29 | +| stable | [2023-11-01](/rest/api/searchservice/operation-groups?view=rest-searchservice-2023-11-01&preserve-view=true) (generally available <sup>3</sup>)| |
| 30 | +| preview | 2024-05-01-preview (no change) | |
| 31 | +| stable | [2024-07-01 (REST)](/rest/api/searchservice/indexes/create-or-update?view=rest-searchservice-2024-07-01&preserve-view=true) (no change) | |
| 32 | +| preview | 2024-09-01-preview (no change) | |
| 33 | +| preview | 2024-11-01-preview (adds query rewrite <sup>4</sup>) | |
| 34 | + |
| 35 | +<sup>1</sup> Starting on July 14, 2023 updates to the Microsoft-hosted semantic models made semantic ranker language-agnostic, effectively decommissioning the `queryLanguage` property for semantic ranking. There's no breaking change in code, but the property is ignored. Customers were advised to remove this property from code. |
| 36 | + |
| 37 | +<sup>2</sup> API version 2023-07-01-preview introduced changes to semantic configuration that are now abandoned. Don't use this version. |
| 38 | + |
| 39 | +<sup>3</sup> API version 2023-10-01-preview introduced changes to semantic configuration that progressed to the stable version. If your code targets this version or later, it's compatible with newer API versions unless you adopt new preview features. |
| 40 | + |
| 41 | +<sup>4</sup> The `queryLanguage` property is now required if you use [query rewrite (preview)](semantic-how-to-query-rewrite.md). |
| 42 | + |
| 43 | +## Change logs for Azure SDKs |
| 44 | + |
| 45 | +Azure SDKs are on an independent release schedule. You should check the change logs to determine which packages provide semantic features. |
| 46 | + |
| 47 | ++ [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) |
| 48 | ++ [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) |
| 49 | ++ [Azure SDK for Java change log](https://github.com/Azure/azure-sdk-for-java/blob/azure-search-documents_11.6.1/sdk/search/azure-search-documents/CHANGELOG.md#1160-2023-11-13) |
| 50 | ++ [Azure SDK for JavaScript change log](https://github.com/Azure/azure-sdk-for-js/blob/%40azure/search-documents_12.0.0/sdk/search/search-documents/CHANGELOG.md#1200-2023-11-13) |
| 51 | + |
| 52 | +## 2024-11-01-preview |
| 53 | + |
| 54 | ++ Adds [query rewrite](semantic-how-to-query-rewrite.md) to Search Documents. |
| 55 | ++ Requires `queryLanguage` for query rewrite workloads. |
| 56 | + |
| 57 | +## 2024-09-01-preview |
| 58 | + |
| 59 | +No changes to semantic ranking syntax from the 2024-07-01 stable version. |
| 60 | + |
| 61 | +## 2024-07-01 |
| 62 | + |
| 63 | +No changes to semantic ranking syntax from the 2024-05-01-preview version. |
| 64 | + |
| 65 | +Don't use this API version. It implements a vector query syntax that's incompatible with any newer API version. |
| 66 | + |
| 67 | +## 2024-05-01-preview |
| 68 | + |
| 69 | +No changes to semantic ranking syntax from the 2024-03-01-preview version. |
| 70 | + |
| 71 | +## 2024-03-01-preview |
| 72 | + |
| 73 | +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. |
| 74 | + |
| 75 | +## 2023-11-01 |
| 76 | + |
| 77 | ++ Excludes `SemanticDebug` and `semanticQuery`, otherwise the same as the 2023-10-01-preview version. |
| 78 | + |
| 79 | +## 2023-10-01-preview |
| 80 | + |
| 81 | ++ Adds `semanticQuery` |
| 82 | + |
| 83 | +## 2023-07-01-preview |
| 84 | + |
| 85 | ++ Adds `semanticErrorHandling`, `semanticMaxWaitInMilliseconds`. |
| 86 | ++ Adds numerous semantic-related fields to the response, such as `SemanticDebug` and `SemanticErrorMode`. |
| 87 | ++ Ignores `queryLanguage`, it's no longer used in semantic ranking. |
| 88 | + |
| 89 | +Starting on July 14, 2023, semantic ranker is language agnostic. In preview versions, semantic ranking would deprioritize results differing from the `querylanguage` specified by the field analyzer. However, the `queryLanguage` property is still applicable to [spell correction](speller-how-to-add.md) and the short list of languages supported by that feature. |
| 90 | + |
| 91 | +## 2021-04-30-preview |
| 92 | + |
| 93 | ++ Semantic support is now scoped to both [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. |
| 94 | ++ Adds `semanticConfiguration` to a search index. A semantic configuration has a name and a prioritized field list. |
| 95 | ++ Adds `semanticFields`. The `searchFields` property is no longer used to prioritize fields. |
| 96 | + |
| 97 | +In all versions after `2020-06-30-preview`, `semanticConfiguration` replaces `searchFields` as the mechanism for specifying which fields to use for L2 ranking. |
| 98 | + |
| 99 | +## 2020-06-30-preview |
| 100 | + |
| 101 | ++ Semantic support is scoped to a [Search Documents](/rest/api/searchservice/preview-api/search-documents) preview API call. |
| 102 | ++ Adds `queryType=semantic` to the query request. |
| 103 | ++ Adapts `searchFields` so that if the query type is semantic, the `searchFields` property determines the priority order of field.inputs to the semantic ranker. |
| 104 | ++ Adds `captions`, `answers`, and `highlights` to the query response. |
| 105 | + |
| 106 | +## Next steps |
| 107 | + |
| 108 | +Test your semantic configuration by running a semantic query. |
| 109 | + |
| 110 | +> [!div class="nextstepaction"] |
| 111 | +> [Create a semantic query](semantic-how-to-query-request.md) |
0 commit comments