Skip to content

Commit 6b3da59

Browse files
committed
maxTextRecallSize updates
1 parent 84eaafc commit 6b3da59

File tree

4 files changed

+68
-16
lines changed

4 files changed

+68
-16
lines changed

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

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.service: cognitive-search
99
ms.custom:
1010
- ignite-2023
1111
ms.topic: how-to
12-
ms.date: 04/23/2024
12+
ms.date: 06/12/2024
1313
---
1414

1515
# Create a hybrid query in Azure AI Search
@@ -18,7 +18,7 @@ ms.date: 04/23/2024
1818

1919
In most cases, [per benchmark tests](https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid/ba-p/3929167), hybrid queries with semantic ranking return the most relevant results.
2020

21-
To define a hybrid query, use REST API [**2023-11-01**](/rest/api/searchservice/documents/search-post), [**2023-10-01-preview**](/rest/api/searchservice/documents/search-post?view=rest-searchservice-2023-10-01-preview&preserve-view=true), [**2024-03-01-preview**](/rest/api/searchservice/documents/search-post?view=rest-searchservice-2024-03-01-preview&preserve-view=true), Search Explorer in the Azure portal, or newer versions of the Azure SDKs.
21+
New parameters [maxTextRecallSize and countAndFacetMode(preview)](#relevance-tuning-through-maxtextrecallsize-and-countandfacetmode-preview) give you more control over inputs into a hybrid query. You can also use [vector weighting](vector-search-how-to-query.md#vector-weighting-preview) on the vector side of a hybrid query to specify 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.
2222

2323
## Prerequisites
2424

@@ -28,6 +28,15 @@ To define a hybrid query, use REST API [**2023-11-01**](/rest/api/searchservice/
2828

2929
+ (Optional) If you want text-to-vector conversion of a query string (currently in preview), [create and assign a vectorizer](vector-search-how-to-configure-vectorizer.md) to vector fields in the search index.
3030

31+
## Choose an API or tool
32+
33+
+ [**2023-11-01**](/rest/api/searchservice/documents/search-post) stable version
34+
+ [**2023-10-01-preview**](/rest/api/searchservice/documents/search-post?view=rest-searchservice-2023-10-01-preview&preserve-view=true), adds integrated vectorization to the vector side of a hybrid query
35+
+ [**2024-03-01-preview**](/rest/api/searchservice/documents/search-post?view=rest-searchservice-2024-03-01-preview&preserve-view=true), adds narrow data types and scalar quantization to the vector side of a hybrid query
36+
+ [**2024-05-01-preview**](/rest/api/searchservice/documents/search-post?view=rest-searchservice-2024-05-01-preview&preserve-view=true) adds `maxTextRecallSize` and `countAndFacetMode` specifially for hybrid search
37+
+ Search Explorer in the Azure portal (targets 2024-05-01-preview behaviors)
38+
+ Newer stable or beta packages of the Azure SDKs (see change logs for SDK feature support)
39+
3140
## Run a hybrid query in Search Explorer
3241

3342
1. In [Search Explorer](search-explorer.md), make sure the API version is **2023-10-01-preview** or later.
@@ -222,7 +231,37 @@ api-key: {{admin-api-key}}
222231

223232
+ 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.
224233

225-
+ 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
234+
+ 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.
235+
236+
## Relevance tuning through maxTextRecallSize and countAndFacetMode (preview)
237+
238+
In a `hybridSearch` query parameter object, specify the maximum number of documents recalled through the text portion of a hybrid (text and vector) query. The default is `1000` documents. With this parameter, you can increase or decrease the number of results returned in hybrid queries. Reducing the number of text documents retrieved can significantly improve performance.
239+
240+
You can set `countAndFacetMode` property to report the counts for the text query (and for facets if you're using them) to the document limits set by `maxTextRecallSize`.
241+
242+
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.
243+
244+
The following example sets `maxTextRecallSize` to 100, which limits the results from the text side of the hybrid query to just 100 documents instead of all matches (up to 1,000 document default). It also sets `countAndFacetMode` to include only those results from `maxTextRecallSize`.
245+
246+
```http
247+
POST https://[service-name].search.windows.net/indexes/[index-name]/docs/search?api-version=2024-05-01-Preview
248+
249+
{
250+
  "vectorQueries": [
251+
    {
252+
      "kind": "vector",
253+
      "vector": [1.0, 2.0, 3.0],
254+
      "fields": "my_vector_field",
255+
      "k": 10
256+
    }
257+
  ],
258+
  "search": "hello world",
259+
  "hybridSearch": {
260+
    "maxTextRecallSize": 100,
261+
    "countAndFacetMode": "countRetrievableResults"
262+
  }
263+
}
264+
```
226265

227266
## Configure a query response
228267

articles/search/hybrid-search-ranking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.service: cognitive-search
99
ms.custom:
1010
- ignite-2023
1111
ms.topic: conceptual
12-
ms.date: 11/01/2023
12+
ms.date: 06/12/2024
1313
---
1414

1515
# Relevance scoring in hybrid search using Reciprocal Rank Fusion (RRF)

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

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.service: cognitive-search
99
ms.custom:
1010
- build-2024
1111
ms.topic: how-to
12-
ms.date: 05/30/2024
12+
ms.date: 06/12/2024
1313
---
1414

1515
# Create a vector query in Azure AI Search
@@ -22,7 +22,6 @@ In Azure AI Search, if you have a [vector index](vector-search-how-to-create-ind
2222
> + [Query multiple vector fields at once](#multiple-vector-fields)
2323
> + [Query with integrated vectorization (preview)](#query-with-integrated-vectorization-preview)
2424
> + [Set thresholds to exclude low-scoring results (preview)](#set-thresholds-to-exclude-low-scoring-results-preview)
25-
> + [Set MaxTextSizeRecall to control the number of results (preview)](#maxtextsizerecall-for-hybrid-search-preview)
2625
> + [Set vector weights (preview)](#vector-weighting-preview)
2726
2827
This article uses REST for illustration. For code samples in other languages, see the [azure-search-vector-samples](https://github.com/Azure/azure-search-vector-samples) GitHub repository for end-to-end solutions that include vector queries.
@@ -598,14 +597,19 @@ POST https://[service-name].search.windows.net/indexes/[index-name]/docs/search?
598597

599598
Filtering occurs before [fusing results](hybrid-search-ranking.md) from different recall sets.
600599

600+
<!-- This section should be in hybrid search only, but keeping a copy here to avoid broken links in a blog post. -->
601601
## MaxTextSizeRecall for hybrid search (preview)
602602

603-
Add a `hybridSearch` query parameter object to specify the maximum number of documents recalled using text queries in hybrid (text and vector) search. The default is 1,000 documents. With this parameter, you can increase or decrease the number of results returned in hybrid queries.
603+
In a `hybridSearch` query parameter object, specify the maximum number of documents recalled through the text portion of a hybrid (text and vector) query. The default is `1000` documents. With this parameter, you can increase or decrease the number of results returned in hybrid queries. Reducing the number of text documents retrieved can significantly improve performance.
604+
605+
You can set `countAndFacetMode` property to report the counts for the text query (and for facets if you're using them) to the document limits set by `maxTextRecallSize`.
606+
607+
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.
608+
609+
The following example sets `maxTextRecallSize` to 100, which limits the results from the text side of the hybrid query to just 100 documents instead of all matches (up to 1,000 document default). It also sets `countAndFacetMode` to include only those results from `maxTextRecallSize`.
604610

605611
```http
606612
POST https://[service-name].search.windows.net/indexes/[index-name]/docs/search?api-version=2024-05-01-Preview
607-
Content-Type: application/json
608-
api-key: [admin key]
609613
610614
{
611615
  "vectorQueries": [
@@ -619,30 +623,39 @@ POST https://[service-name].search.windows.net/indexes/[index-name]/docs/search?
619623
  "search": "hello world",
620624
  "hybridSearch": {
621625
    "maxTextRecallSize": 100,
622-
    "countAndFacetMode": "countAllResults"
626+
    "countAndFacetMode": "countRetrievableResults"
623627
  }
624628
}
625629
```
626630

627631
## Vector weighting (preview)
628632

629-
Add a `weight` query parameter to specify the relative weight of each vector included in search operations. This feature is particularly useful in complex queries where two or more distinct result sets need to be combined, such as in hybrid search or multivector requests.
633+
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.
634+
635+
The default is 1.0 and the value must be a positive number larger than zero.
630636

631-
Weights are used when calculating the [reciprocal rank fusion](hybrid-search-ranking.md) scores of each document. The calculation is multiplier of the `weight` value against the rank score of the document within its respective result set.
637+
Weights are used when calculating the [reciprocal rank fusion](hybrid-search-ranking.md) scores of each document. The calculation is multiplier of the `weight` value against the rank score of the document within its respective result set.
638+
639+
The following example is a hybrid query with two vector query strings and one text string. Weights are assigned to the vector queries. The first query is 0.5 or half the weight, reducing its importance in the request. The second vectory query is twice as important. Text queries have no weight parameters, but you can increase or decrease their importance by setting [maxTextRecallSize](hybrid-search-how-to-query.md#ranking).
632640

633641
```http
634642
POST https://[service-name].search.windows.net/indexes/[index-name]/docs/search?api-version=2024-05-01-Preview
635-
Content-Type: application/json
636-
api-key: [admin key]
637643
638644
{
639645
  "vectorQueries": [
640646
    {
641647
      "kind": "vector",
642648
      "vector": [1.0, 2.0, 3.0],
643-
      "fields": "my_vector_field",
649+
      "fields": "my_first_vector_field",
644650
      "k": 10,
645651
      "weight": 0.5
652+
    },
653+
    {
654+
      "kind": "vector",
655+
      "vector": [4.0, 5.0, 6.0],
656+
      "fields": "my_second_vector_field",
657+
      "k": 10,
658+
      "weight": 2.0
646659
    }
647660
  ],
648661
  "search": "hello world"

articles/search/whats-new.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ms.custom:
2525
|-----------------------------|------|--------------|
2626
| [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).|
2727
| [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 tuning and search results customization](vector-search-how-to-query.md) | Feature | Three enhancements improve vector search relevance. <br><br>First, you can now set thresholds on vector search results to exclude low-scoring results. <br><br>Second, you can set `MaxSizeTextRecall` and `countAndFacetMode` in hybrid queries to specify the maximum number of documents that can be recalled using text query in hybrid (text and vector) search. Previously, the maximum was fixed at 1,000. If you have more matches, you can now specify a higher limit to get more results back. <br><br>Third, for hybrid queries, you can set a weight on vector queries to have more or less importance than the nonvector query. |
28+
| [Vector results customization](vector-search-how-to-query.md) and [hybrid query optimizations](hybrid-search-how-to-query.md) | Feature | Three enhancements improve vector search relevance. <br><br>First, you can now set thresholds on vector search results to exclude low-scoring results. <br><br>Second, you can set `MaxTextRecallSize` and `countAndFacetMode` in hybrid queries to specify the maximum number of documents that can be recalled using text query in hybrid (text and vector) search. Previously, the maximum was fixed at `1000`, and the default is still `1000`. However, if you have more matches, you can now specify a higher limit on top and skip to get more results back. <br><br>Third, for hybrid queries queries, you can set a weight on vector queries to have more or less importance than the nonvector query. |
2929
| [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.|
3030
| [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).|
3131
| [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

Comments
 (0)