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/hybrid-search-how-to-query.md
+39-18Lines changed: 39 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ In many cases, [per benchmark tests](https://techcommunity.microsoft.com/t5/ai-a
21
21
To improve relevance:
22
22
23
23
+ New parameters [maxTextRecallSize and countAndFacetMode(preview)](#set-maxtextrecallsize-and-countandfacetmode-preview) give you more control over text inputs into a hybrid query.
24
+
24
25
+ New [vector weighting](vector-search-how-to-query.md#vector-weighting-preview) lets you set the relative weight of the vector query. This feature is particularly useful in complex queries where two or more distinct result sets need to be combined, as is the case for hybrid search.
25
26
26
27
## Prerequisites
@@ -85,22 +86,37 @@ POST https://{{search-service-name}}.search.windows.net/indexes/{{index-name}}/d
85
86
Content-Type: application/json
86
87
api-key: {{admin-api-key}}
87
88
{
88
-
"vectorQueries": [{
89
-
"vector": [
90
-
-0.009154141,
91
-
0.018708462,
92
-
. . .
93
-
-0.02178128,
94
-
-0.00086512347
95
-
],
96
-
"fields": "DescriptionVector",
97
-
"kind": "vector",
98
-
"exhaustive": true,
99
-
"k": 10
100
-
}],
89
+
"vectorQueries": [
90
+
{
91
+
"vector": [
92
+
-0.009154141,
93
+
0.018708462,
94
+
. . .
95
+
-0.02178128,
96
+
-0.00086512347
97
+
],
98
+
"fields": "DescriptionVector",
99
+
"kind": "vector",
100
+
"exhaustive": true,
101
+
"k": 10
102
+
},
103
+
{
104
+
"vector": [
105
+
-0.009154141,
106
+
0.018708462,
107
+
. . .
108
+
-0.02178128,
109
+
-0.00086512347
110
+
],
111
+
"fields": "DescriptionVector",
112
+
"kind": "vector",
113
+
"exhaustive": true,
114
+
"k": 10
115
+
}
116
+
],
101
117
"search": "historic hotel walk to restaurants and shopping",
102
118
"select": "HotelName, Description, Address/City",
103
-
"top": "10"
119
+
"top": 10
104
120
}
105
121
```
106
122
@@ -238,21 +254,26 @@ api-key: {{admin-api-key}}
238
254
239
255
## Set maxTextRecallSize and countAndFacetMode (preview)
240
256
241
-
This section explains how to adjust the inputs to a hybrid query by controlling the amount BM25-ranked results contributed to the query. Adjustments on the BM25-ranked results can improve hybrid query performance. Another option to consider is a supplemental or replacement technique, is [vector weighting](vector-search-how-to-query.md#vector-weighting-preview), which increases the importance of vector queries in the request.
257
+
This section explains how to adjust the inputs to a hybrid query by controlling the amount BM25-ranked results that flow to the hybrid ranking model. Controlling over the BM25-ranked input gives you more options for relevance tuning in hybrid scenarios.
258
+
259
+
> [!TIP]
260
+
> Another option to consider is a supplemental or replacement technique, is [vector weighting](vector-search-how-to-query.md#vector-weighting-preview), which increases the importance of vector queries in the request.
242
261
243
-
1. Use [Search - POST](/rest/api/searchservice/documents/search-post?view=rest-searchservice-2024-05-01-preview&preserve-view=true) or [Search - GET](/rest/api/searchservice/documents/search-get?view=rest-searchservice-2024-05-01-preview&preserve-view=true) in `2024-05-01-Preview` to specify these parameters.
262
+
1. Use [Search - POST](/rest/api/searchservice/documents/search-post?view=rest-searchservice-2024-05-01-preview&preserve-view=true) or [Search - GET](/rest/api/searchservice/documents/search-get?view=rest-searchservice-2024-05-01-preview&preserve-view=true) in 2024-05-01-preview to specify these parameters.
244
263
245
264
1. Add a `hybridSearch` query parameter object to set the maximum number of documents recalled through the BM25-ranked results of a hybrid query. It has two properties:
246
265
247
266
+`maxTextRecallSize` specifies the number of BM25-ranked results to provide to the Reciprocal Rank Fusion (RRF) ranker used in hybrid queries. The default is 1,000. The maximum is 10,000.
248
267
249
268
+`countAndFacetMode` reports the counts for the BM25-ranked results (and for facets if you're using them). The default is all documents that match the query. Optionally, you can scope "count" to the `maxTextRecallSize`.
250
269
251
-
1.Lower`maxTextRecallSize`below the default to improve performance, assuming vector similarity search is generally outperforming the text-side of the the hybrid query.
270
+
1.Reduce`maxTextRecallSize`if vector similarity search is generally outperforming the text-side of the the hybrid query.
252
271
253
272
1. Raise `maxTextRecallSize` if you have a large index, and the default isn't capturing a sufficient number of results. With a larger BM25-ranked result set, you can also set `top`, `skip`, and `next` to retrieve portions of those results.
254
273
255
-
The following REST examples show two use-cases for setting `maxTextRecallSize`. The first example lowers `maxTextRecallSize` to 100, limiting the text side of the hybrid query to just 100 document. It also sets `countAndFacetMode` to include only those results from `maxTextRecallSize`.
274
+
The following REST examples show two use-cases for setting `maxTextRecallSize`.
275
+
276
+
The first example reduces `maxTextRecallSize` to 100, limiting the text side of the hybrid query to just 100 document. It also sets `countAndFacetMode` to include only those results from `maxTextRecallSize`.
256
277
257
278
```http
258
279
POST https://[service-name].search.windows.net/indexes/[index-name]/docs/search?api-version=2024-05-01-Preview
Copy file name to clipboardExpand all lines: articles/search/hybrid-search-ranking.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,15 +61,19 @@ Semantic ranking doesn't participate in RRF. Its score (`@search.rerankerScore`)
61
61
62
62
Starting in 2024-05-01-preview, you can [weight vector queries](vector-search-how-to-query.md#vector-weighting-preview) to increase or decrease their importance in a hybrid query.
63
63
64
-
Recall that when computing RRF for a certain document, the search engine looks at the rank of that document for each result set where it shows up. Assume a document shows up three search result, where the results are from two vector queries and one text BM25-ranked query. The position of the document varies in each result:
64
+
Recall that when computing RRF for a certain document, the search engine looks at the rank of that document for each result set where it shows up. Assume a document shows up in three separate search results, where the results are from two vector queries and one text BM25-ranked query. The position of the document varies in each result.
65
65
66
-
+ vector results one, match is in position 1
67
-
+ vector results two, match is in position 5
68
-
+ BM25 results, match is in position 10
66
+
| Match found | Position in results |@search.score | weight multiplier |@search.score (weighted) |
67
+
|--|--|--|--|--|--|
68
+
| vector results one | position 1 | 0.8383955 | 0.5 | 0.41919775 |
69
+
| vector results two | position 5 | 0.81514114 | 2.0 | 1.63028228 |
70
+
| BM25 results | position 10 | 0.8577363 | NA | 0.8577363 |
69
71
70
72
The document's position in each result set corresponds to an initial score, which are added up to create the final RRF score for that document.
71
73
72
-
If you add vector weighting, the initial scores are subect to a weighting multipilier that increases or decreases the score. The default is 1.0, which means no weighting and the initial score is used as-is in RRF scoring. However, if you add a weight of 0.5, the score is reduced and that result becomes less important in the combined ranking. Conversely, if you add a weight of 2.0, the score becomes a larger factor in the overall RRF score.
74
+
If you add vector weighting, the initial scores are subect to a weighting multiplier that increases or decreases the score. The default is 1.0, which means no weighting and the initial score is used as-is in RRF scoring. However, if you add a weight of 0.5, the score is reduced and that result becomes less important in the combined ranking. Conversely, if you add a weight of 2.0, the score becomes a larger factor in the overall RRF score.
75
+
76
+
In this example, the @search.score (weighted) values are passed to the RRF ranking model.
73
77
74
78
## Number of ranked results in a hybrid query response
Copy file name to clipboardExpand all lines: articles/search/vector-search-how-to-query.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -604,6 +604,8 @@ Vector queries are often used in hybrid constructs that include nonvector fields
604
604
605
605
You can only set this property in hybrid requests that include both "search" and "vectorQueries" components.
606
606
607
+
For more information, see [Set maxTextRecallSize - Create a hybrid query](hybrid-search-how-to-query.md#set-maxtextrecallsize-and-countandfacetmode-preview).
608
+
607
609
## Vector weighting (preview)
608
610
609
611
Add a `weight` query parameter to specify the relative weight of each vector included in search operations. This value is used when combining the results of multiple ranking lists produced by two or more vector queries in the same request, or from the vector portion of a hybrid query.
|[Higher capacity and more vector quota at every tier (same billing rate)](search-limits-quotas-capacity.md#service-limits)| Infrastructure | Partition sizes are now even larger for Standard 2 (S2), Standard 3 (S3), and Standard 3 High Density (S3 HD) for all services created after April 3, 2024. If you create a new service now, you get the larger partitions. If you created a new service between April 3 and May 17, you get the larger partitions automatically. <br><br>Storage Optimized tiers (L1 and L2) also have more capacity. L1 and L2 customers must create a new service to benefit from the higher capacity. There's no in-place upgrade at this time. <br><br>Extra capacity is now available in [more regions](search-limits-quotas-capacity.md#supported-regions-with-higher-storage-limits): Germany North, Germany West Central, South Africa North, Switzerland West, and Azure Government (Texas, Arizona, and Virginia).|
27
27
|[OneLake integration (preview)](search-how-to-index-onelake-files.md)| Feature | New indexer for OneLake files and OneLake shortcuts. If you use Microsoft Fabric and OneLake for data access to Amazon Web Services (AWS) and Google data sources, use this indexer to import external data into a search index. This indexer is available through the Azure portal, the [2024-05-01-preview REST API](/rest/api/searchservice/data-sources/create-or-update?view=rest-searchservice-2024-05-01-preview&preserve-view=true), and Azure SDK beta packages. |
28
-
|[Vector relevance](vector-search-how-to-query.md) <br>[hybrid query relevance](hybrid-search-how-to-query.md)| Feature | Four enhancements improve vector and hybrid search relevance. <br><br>First, you can now set thresholds on vector search results to exclude low-scoring results. <br><br>Second, changes in the query architecture apply scoring profiles at the end of the query pipeline for every query type. Document boosting is a common scoring profile, and it now works as expected on vector and hybrid queries.<br><br>Third, you can set `MaxTextRecallSize` and `countAndFacetMode` in hybrid queries to control the quantity of BM25-ranked search results to contribute to hybrid ranking. <br><br>Fourth, for vector and hybrid search, you can weight a vector queries to have boost or diminish its importance in a multi-query request. |
28
+
|[Vector relevance](vector-search-how-to-query.md) <br>[hybrid query relevance](hybrid-search-how-to-query.md)| Feature | Four enhancements improve vector and hybrid search relevance. <br><br>First, you can now set thresholds on vector search results to exclude low-scoring results. <br><br>Second, changes in the query architecture apply scoring profiles at the end of the query pipeline for every query type. Document boosting is a common scoring profile, and it now works as expected on vector and hybrid queries.<br><br>Third, you can set `MaxTextRecallSize` and `countAndFacetMode` in hybrid queries to control the quantity of BM25-ranked search results that flow into the hybrid ranking model. <br><br>Fourth, for vector and hybrid search, you can weight a vector query to have boost or diminish its importance in a multiquery request. |
29
29
|[Binary vectors support](/rest/api/searchservice/supported-data-types)| Feature |`Collection(Edm.Byte)` is a new supported data type. This data type opens up integration with the [Cohere v3 binary embedding models](https://cohere.com/blog/int8-binary-embeddings) and custom binary quantization. Narrow data types lower the cost of large vector datasets. See [Index binary data for vector search](vector-search-how-to-index-binary-data.md) for more information.|
30
30
|[Azure AI Vision multimodal embeddings skill (preview)](cognitive-search-skill-vision-vectorize.md)| Skill | New skill that's bound to the [multimodal embeddings API of Azure AI Vision](../ai-services/computer-vision/concept-image-retrieval.md). You can generate embeddings for text or images during indexing. This skill is available through the Azure portal and the [2024-05-01-preview REST API](/rest/api/searchservice/operation-groups?view=rest-searchservice-2024-05-01-preview&preserve-view=true).|
31
31
|[Azure AI Vision vectorizer (preview)](vector-search-vectorizer-ai-services-vision.md)| Vectorizer | New vectorizer connects to an Azure AI Vision resource using the [multimodal embeddings API](../ai-services/computer-vision/concept-image-retrieval.md) to generate embeddings at query time. This vectorizer is available through the Azure portal and the [2024-05-01-preview REST API](/rest/api/searchservice/operation-groups?view=rest-searchservice-2024-05-01-preview&preserve-view=true). |
0 commit comments