Skip to content

Commit a3d57e7

Browse files
authored
Merge pull request #123454 from spygi/patch-1
fix: clarify between top, k and maxTextRecallSize parameters
2 parents 53ea1b0 + a86c636 commit a3d57e7

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ api-key: {{admin-api-key}}
203203

204204
**Key points:**
205205

206-
+ Semantic ranking accepts up to 50 results from the merged response. Set "k" and "top" to 50 for equal representation of both queries.
206+
+ Semantic ranking accepts up to 50 results from the merged response.
207207

208208
+ "queryType" and "semanticConfiguration" are required.
209209

@@ -338,14 +338,28 @@ The examples in this article used a "select" statement to specify text (nonvecto
338338
339339
### Number of results
340340

341-
A query might match to any number of documents, as many as all of them if the search criteria are weak (for example "search=*" for a null query). Because it's seldom practical to return unbounded results, you should specify a maximum for the response:
341+
A query might match to any number of documents, as many as all of them if the search criteria are weak (for example "search=*" for a null query). Because it's seldom practical to return unbounded results, you should specify a maximum for the *overall response*:
342342

343+
+ `"top": n` results for keyword-only queries (no vector)
343344
+ `"k": n` results for vector-only queries
344-
+ `"top": n` results for hybrid queries that include a "search" parameter
345+
+ `"top": n` results for hybrid queries (with or without semantic) that include a "search" parameter
345346

346347
Both "k" and "top" are optional. Unspecified, the default number of results in a response is 50. You can set "top" and "skip" to [page through more results](search-pagination-page-layout.md#paging-results) or change the default.
347348

348-
If you're using semantic ranking, it's a best practice to set both "k" and "top" to at least 50. The semantic ranker can take up to 50 results. By specifying 50 for each query, you get equal representation from both search subsystems.
349+
> [!NOTE]
350+
> If you're using hybrid search in 2024-05-01-preview API, you can control the number of results from the keyword query using [maxTextRecallSize](#set-maxtextrecallsize-and-countandfacetmode-preview). Combine this with a setting for "k" to control the representation from each search subsystem (keyword and vector).
351+
352+
#### Semantic ranker results
353+
354+
> [!NOTE]
355+
> The semantic ranker can take up to 50 results.
356+
357+
If you're using semantic ranking in 2024-05-01-preview API, it's a best practice to set "k" and "maxTextRecallSize" to sum to at least 50 total. You can then restrict the results returned to the user with the "top" parameter.
358+
359+
If you're using semantic ranking in previous APIs do the following:
360+
361+
+ if doing keyword-only search (no vector) set "top" to 50
362+
+ if doing hybrid search set "k" to 50, to ensure that the semantic ranker gets at least 50 results.
349363

350364
### Ranking
351365

0 commit comments

Comments
 (0)