Skip to content

Commit 25c7e3e

Browse files
authored
DEV: (cmds) update FT.PROFILE and FT.HYBRID commands (#3340)
* DEV: (cmds) update FT.PROFILE and FT.HYBRID commands * Tweak command page and add add'l info to vector search page
1 parent 5d1e3a3 commit 25c7e3e

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

content/commands/ft.hybrid.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ railroad_diagram: /images/railroad/ft.hybrid.svg
504504
since: 8.4.0
505505
summary: Performs hybrid search combining text search and vector similarity search
506506
syntax_fmt: "FT.HYBRID index\n SEARCH query\n [SCORER scorer]\n [YIELD_SCORE_AS\
507-
\ name]\n VSIM vector_field $vector_param\n [KNN count K k [EF_RUNTIME ef_runtime]]\n\
507+
\ name]\n VSIM vector_field $vector_param\n [KNN count K k [EF_RUNTIME ef_runtime]] [SHARD_K_RATIO shard_k_ratio]]\n\
508508
\ [RANGE count RADIUS radius [EPSILON epsilon]]\n [YIELD_SCORE_AS name]\n\
509509
\ [FILTER filter]\n [COMBINE RRF count [CONSTANT constant] [WINDOW window]\
510510
\ [YIELD_SCORE_AS name]]\n [COMBINE LINEAR count [[ALPHA alpha] [BETA beta]] [WINDOW\
@@ -566,9 +566,9 @@ assigns an alias to the search score for use in post-processing operations like
566566
</details>
567567

568568
<details open>
569-
<summary><code>KNN count K top-k [EF_RUNTIME ef-value] [YIELD_SCORE_AS name]</code></summary>
569+
<summary><code>KNN count K top-k [EF_RUNTIME ef-value] [SHARD_K_RATIO shard-k-ratio] [YIELD_SCORE_AS name]</code></summary>
570570

571-
configures K-nearest neighbors search for vector similarity. The `count` parameter indicates the number of following parameters. `K` specifies the number of nearest neighbors to find. `EF_RUNTIME` controls the search accuracy vs. speed tradeoff. `YIELD_SCORE_AS` assigns an alias to the score value.
571+
configures K-nearest neighbors search for vector similarity. The `count` parameter indicates the number of following parameters. `K` specifies the number of nearest neighbors to find. `EF_RUNTIME` controls the search accuracy vs. speed tradeoff. `SHARD_K_RATIO` controls the number of results each shard retrieves relative to the requested `top_k` in cluster setups. `YIELD_SCORE_AS` assigns an alias to the score value. See the [vector search]({{< relref "/develop/ai/search-and-query/vectors#cluster-optimization-examples" >}}) documentation for more information about `SHARD_K_RATIO`.
572572
</details>
573573

574574
<details open>

content/commands/ft.profile.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ module: Search
4545
railroad_diagram: /images/railroad/ft.profile.svg
4646
since: 2.2.0
4747
stack_path: docs/interact/search-and-query
48-
summary: Performs a `FT.SEARCH` or `FT.AGGREGATE` command and collects performance
48+
summary: Performs a `FT.SEARCH`, `FT.HYBRID`, or `FT.AGGREGATE` command and collects performance
4949
information
50-
syntax_fmt: FT.PROFILE index <SEARCH | AGGREGATE> [LIMITED] QUERY query
50+
syntax_fmt: FT.PROFILE index <SEARCH | HYBRID | AGGREGATE> [LIMITED] QUERY query
5151
title: FT.PROFILE
5252
---
5353

54-
Apply [`FT.SEARCH`]({{< relref "commands/ft.search/" >}}) or [`FT.AGGREGATE`]({{< relref "commands/ft.aggregate/" >}}) command to collect performance details. For usage, see [Examples](#examples).
54+
Apply [`FT.SEARCH`]({{< relref "commands/ft.search/" >}}), [`FT.HYBRID`]({{< relref "commands/ft.hybrid/" >}}), or [`FT.AGGREGATE`]({{< relref "commands/ft.aggregate/" >}}) command to collect performance details. For usage, see [Examples](#examples).
5555

5656
## Required arguments
5757

@@ -62,9 +62,9 @@ is the name of an index created using [`FT.CREATE`]({{< relref "commands/ft.crea
6262
</details>
6363

6464
<details open>
65-
<summary><code>SEARCH | AGGREGATE</code></summary>
65+
<summary><code>SEARCH | HYBRID | AGGREGATE</code></summary>
6666

67-
represents the profile type, either [`FT.SEARCH`]({{< relref "commands/ft.search/" >}}) or [`FT.AGGREGATE`]({{< relref "commands/ft.aggregate/" >}}).
67+
represents the profile type, either [`FT.SEARCH`]({{< relref "commands/ft.search/" >}}), [`FT.HYBRID`]({{< relref "commands/ft.hybrid/" >}}), or [`FT.AGGREGATE`]({{< relref "commands/ft.aggregate/" >}}).
6868
</details>
6969

7070
<details open>
@@ -76,7 +76,7 @@ removes details of any `reader` iterators.
7676
<details open>
7777
<summary><code>QUERY {query}</code></summary>
7878

79-
is the query string, sent to `FT.SEARCH` or `FT.AGGREGATE`.
79+
is the query string, sent to `FT.SEARCH`, `FT.HYBRID`, or `FT.AGGREGATE`.
8080
</details>
8181

8282
<note><b>Note:</b> To reduce the size of the output, use `NOCONTENT` or `LIMIT 0 0` to reduce the number of reply results, or `LIMITED` to not reply with details of `reader iterators` inside built-in unions, such as `fuzzy` or `prefix` iterators.</note>
@@ -88,7 +88,7 @@ This page contains the up-to-date profile output as of RediSearch v2.8.33, v2.10
8888
The output format itself may differ between RediSearch versions, and RESP protocol versions.
8989
{{< /note >}}
9090

91-
`FT.PROFILE` returns a two-element array reply. The first element contains the results of the provided `FT.SEARCH` or `FT.AGGREGATE` command.
91+
`FT.PROFILE` returns a two-element array reply. The first element contains the results of the provided `FT.SEARCH`, `FT.HYBRID`, or `FT.AGGREGATE` command.
9292
The second element contains information about query creation, iterator profiles, and result processor profiles.
9393
Details of the second element follow in the sections below.
9494

@@ -103,7 +103,7 @@ If there's only one shard, the label will be omitted.
103103
| `Shard ID` | String containing the unique shard ID. In Redis Open Source, this identifier is denoted as the node ID, and is received from the `RedisModule_GetMyClusterID()` API. (Available as of RediSearch v8.4.3) |
104104
| `Total`&nbsp;`profile`&nbsp;`time` | The total run time (ms) of the query. Normally just a few ms. |
105105
| `Parsing`&nbsp;`time` | The time (ms) spent parsing the query and its parameters into a query plan. Normally just a few ms. |
106-
| `Pipeline`&nbsp;`creation`&nbsp;`time` | The creation time (ms) of the execution plan, including iterators, result processors, and reducers creation. Normally just a few ms for `FT.SEARCH` queries, but expect a larger number for `FT.AGGREGATE` queries. |
106+
| `Pipeline`&nbsp;`creation`&nbsp;`time` | The creation time (ms) of the execution plan, including iterators, result processors, and reducers creation. Normally just a few ms for `FT.SEARCH` or `FT.HYBRID` queries, but expect a larger number for `FT.AGGREGATE` queries. |
107107
| `Total`&nbsp;`GIL`&nbsp;`time` | In multi-threaded deployments, the total time (ms) the query spent holding and waiting for the Redis Global Lock (referred to as GIL) during execution. Note: this value is only valid in the shards profile section. |
108108
| `Warning` | Errors that occurred during query execution. |
109109
| `Internal`&nbsp;`cursor`&nbsp;`reads` | The number of times the coordinator fetched result batches from a given shard during a distributed `AGGREGATE` query in cluster mode. Includes the initial request plus any subsequent batch fetches. |
@@ -460,7 +460,7 @@ One of the following:
460460

461461
## See also
462462

463-
[`FT.SEARCH`]({{< relref "commands/ft.search/" >}}) | [`FT.AGGREGATE`]({{< relref "commands/ft.aggregate/" >}})
463+
[`FT.SEARCH`]({{< relref "commands/ft.search/" >}}) | [`FT.HYBRID`]({{< relref "commands/ft.hybrid/" >}}) | [`FT.AGGREGATE`]({{< relref "commands/ft.aggregate/" >}})
464464

465465
## Related topics
466466

content/develop/ai/search-and-query/vectors/_index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,12 @@ Use a higher ratio for better accuracy when precision is more important than per
564564
FT.SEARCH products "*=>[KNN 20 @product_embedding $BLOB]=>{$SHARD_K_RATIO: 0.8; $YIELD_DISTANCE_AS: similarity}" PARAMS 2 BLOB "\x12\xa9\xf5\x6c" SORTBY similarity DIALECT 2
565565
```
566566

567+
[`FT.HYBRID`]({{< relref "/commands/ft.hybrid" >}}) also supports `SHARD_K_RATIO` as part of its `KNN` clause. The following query combines a text search for `laptop` with vector similarity, returning the top 100 nearest neighbors with each shard providing 50% of the requested results:
568+
569+
```
570+
FT.HYBRID products-idx SEARCH "laptop" VSIM @description_vector $query_vec KNN 4 K 100 SHARD_K_RATIO 0.5 PARAMS 2 query_vec "\x12\xa9\xf5\x6c"
571+
```
572+
567573
### Cluster considerations and best practices
568574

569575
When using `$SHARD_K_RATIO` in Redis cluster environments, consider the following behavioral characteristics and best practices:

0 commit comments

Comments
 (0)