Skip to content

Commit b7f4207

Browse files
doc: ft commands updated (#483)
* doc: ft commands updated * doc: ft commands updated * doc: FT.DROPINDEX DD option updated * Update docs/command-reference/search/ft.aggregate.md Co-authored-by: Joe Zhou <[email protected]> Signed-off-by: Volodymyr Yavdoshenko <[email protected]> * fix: links * fix: review comments --------- Signed-off-by: Volodymyr Yavdoshenko <[email protected]> Co-authored-by: Joe Zhou <[email protected]>
1 parent 058927b commit b7f4207

File tree

11 files changed

+467
-37
lines changed

11 files changed

+467
-37
lines changed

docs/command-reference/compatibility.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,18 @@ sidebar_position: 0
344344
| | <span class="command">JSON.STRLEN</span> | <span class="support supported">Fully supported</span> |
345345
| | <span class="command">JSON.TOGGLE</span> | <span class="support supported">Fully supported</span> |
346346
| | <span class="command">JSON.TYPE</span> | <span class="support supported">Fully supported</span> |
347-
| <span class="family">Search</span> | <span class="command">FT.CREATE</span> | <span class="support supported">Fully supported</span> |
348-
| | <span class="command">FT.SEARCH</span> | <span class="support supported">Fully supported</span> |
349-
| | <span class="command">FT.SYNUPDATE</span> | <span class="support supported">Fully supported</span> |
350-
| | <span class="command">FT.SYNDUMP</span> | <span class="support supported">Fully supported</span> |
347+
| <span class="family">Search</span> | <span class="command">FT.CREATE</span> | <span class="support partial">Partially supported</span> |
348+
| | <span class="command">FT.SEARCH</span> | <span class="support partial">Partially supported</span> |
351349
| | <span class="command">FT.ALTER</span> | <span class="support supported">Fully supported</span> |
350+
| | <span class="command">FT.DROPINDEX</span> | <span class="support partial">Partially supported</span> |
351+
| | <span class="command">FT.INFO</span> | <span class="support partial">Partially supported</span> |
352+
| | <span class="command">FT._LIST</span> | <span class="support supported">Fully supported</span> |
353+
| | <span class="command">FT.PROFILE</span> | <span class="support partial">Partially supported</span> |
354+
| | <span class="command">FT.AGGREGATE</span> | <span class="support partial">Partially supported</span> |
352355
| | <span class="command">FT.TAGVALS</span> | <span class="support supported">Fully supported</span> |
356+
| | <span class="command">FT.SYNUPDATE</span> | <span class="support supported">Fully supported</span> |
357+
| | <span class="command">FT.SYNDUMP</span> | <span class="support supported">Fully supported</span> |
358+
| | <span class="command">FT.CONFIG</span> | <span class="support supported">Fully supported</span> |
353359
| <span class="family">Auto Suggest</span> | <span class="command">TBD</span> | <span class="support unsupported">Unsupported</span> |
354360
| <span class="family">T-Digest</span> | <span class="command">TBD</span> | <span class="support unsupported">Unsupported</span> |
355361
| <span class="family">Time Series</span> | <span class="command">TBD</span> | <span class="support unsupported">Unsupported</span> |

docs/command-reference/search/ft._list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ dragonfly> FT._LIST
3232

3333
## Related topics
3434

35-
- [RediSearch](https://redis.io/docs/stack/search)
35+
- [RediSearch](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/)
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
description: Runs a search query and performs aggregate transformations
3+
---
4+
5+
# FT.AGGREGATE
6+
7+
## Syntax
8+
9+
FT.AGGREGATE index query
10+
[LOAD count field [field ...]]
11+
[GROUPBY nargs property [property ...] [REDUCE function nargs arg [arg ...]] [REDUCE function nargs arg [arg ...]]]
12+
[SORTBY nargs property [ASC|DESC] [property [ASC|DESC] ...] [MAX num]]
13+
[LIMIT offset num]
14+
[PARAMS nargs name value [name value ...]]
15+
16+
**Time complexity:** O(N)
17+
18+
## Description
19+
20+
Run a search query and perform aggregate transformations on the results.
21+
22+
This command provides aggregation functionality similar to SQL `GROUP BY` operations, allowing you to group search results and apply reduction functions.
23+
24+
## Required arguments
25+
26+
<details open>
27+
<summary><code>index</code></summary>
28+
29+
is index name. You must first create the index using [`FT.CREATE`](./ft.create.md).
30+
</details>
31+
32+
<details open>
33+
<summary><code>query</code></summary>
34+
35+
is text query to search. If it's more than a single word, put it in quotes.
36+
Refer to [query syntax](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/) for more details.
37+
</details>
38+
39+
## Optional arguments
40+
41+
<details open>
42+
<summary><code>LOAD count field [field ...]</code></summary>
43+
44+
loads additional fields from the document that are not part of the index.
45+
46+
`count` is the number of fields to load.
47+
`field` is the field name to load from the document.
48+
</details>
49+
50+
<details open>
51+
<summary><code>GROUPBY nargs property [property ...] [REDUCE ...]</code></summary>
52+
53+
groups the results according to one or more properties.
54+
55+
`nargs` is the number of properties to group by.
56+
`property` is the property name to group by.
57+
58+
Optionally followed by one or more `REDUCE` clauses that aggregate the grouped results.
59+
</details>
60+
61+
<details open>
62+
<summary><code>REDUCE function nargs arg [arg ...]</code></summary>
63+
64+
applies an aggregate function to the grouped results.
65+
66+
Common functions include:
67+
- `COUNT` - counts the number of records in each group
68+
- `SUM property` - sums the values of the given property
69+
- `MIN property` - finds minimum value
70+
- `MAX property` - finds maximum value
71+
- `AVG property` - calculates average value
72+
- `STDDEV property` - calculates standard deviation
73+
74+
</details>
75+
76+
<details open>
77+
<summary><code>SORTBY nargs property [ASC|DESC] [property [ASC|DESC] ...] [MAX num]</code></summary>
78+
79+
sorts the results by the given properties.
80+
81+
`nargs` is the number of properties to sort by.
82+
`property` is the property name to sort by.
83+
`ASC|DESC` specifies sort order (default is ASC).
84+
`MAX num` limits the number of results.
85+
</details>
86+
87+
<details open>
88+
<summary><code>LIMIT offset num</code></summary>
89+
90+
limits the results to the offset and number of results given.
91+
92+
The offset is zero-indexed. Default is 0 10.
93+
</details>
94+
95+
<details open>
96+
<summary><code>PARAMS nargs name value [name value ...]</code></summary>
97+
98+
defines one or more value parameters that can be referenced in the query.
99+
100+
Similar to [`FT.SEARCH`](./ft.search.md) PARAMS option.
101+
</details>
102+
103+
## Return
104+
105+
`FT.AGGREGATE` returns an array reply with aggregated results based on the specified grouping and reduction operations.
106+
107+
:::info Limited support
108+
FT.AGGREGATE has partial support in Dragonfly. Some advanced aggregation functions and options may not be fully implemented.
109+
:::
110+
111+
## Examples
112+
113+
<details open>
114+
<summary><b>Group results by category and count</b></summary>
115+
116+
```bash
117+
dragonfly> FT.AGGREGATE products "*" GROUPBY 1 @category REDUCE COUNT 0 AS count
118+
```
119+
</details>
120+
121+
<details open>
122+
<summary><b>Calculate average price by category</b></summary>
123+
124+
```bash
125+
dragonfly> FT.AGGREGATE products "*" GROUPBY 1 @category REDUCE AVG 1 @price AS avg_price
126+
```
127+
</details>
128+
129+
## See also
130+
131+
[`FT.SEARCH`](./ft.search.md) | [`FT.CREATE`](./ft.create.md)
132+
133+
## Related topics
134+
135+
- [RediSearch](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/)
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
description: Configure search engine at runtime
3+
---
4+
5+
# FT.CONFIG
6+
7+
## Syntax
8+
9+
FT.CONFIG GET pattern
10+
FT.CONFIG SET option value
11+
FT.CONFIG HELP [option]
12+
13+
**Time complexity:** O(1)
14+
15+
## Description
16+
17+
Configure search engine at runtime.
18+
19+
## Required arguments
20+
21+
<details open>
22+
<summary><code>GET pattern</code></summary>
23+
24+
returns the current values of configuration parameters matching the given pattern.
25+
26+
`pattern` is a glob-style pattern for the configuration parameter names.
27+
</details>
28+
29+
<details open>
30+
<summary><code>SET option value</code></summary>
31+
32+
sets a configuration parameter to the given value.
33+
34+
`option` is the configuration parameter name.
35+
`value` is the new value for the configuration parameter.
36+
</details>
37+
38+
<details open>
39+
<summary><code>HELP [option]</code></summary>
40+
41+
returns help information about configuration parameters.
42+
43+
If `option` is specified, returns help for that specific parameter.
44+
If no option is given, returns help for all available parameters.
45+
</details>
46+
47+
## Available Parameters
48+
49+
DragonflyDB supports the following search configuration parameters:
50+
51+
- **MAXSEARCHRESULTS** - Maximum number of results from ft.search command. Default: `1000000`
52+
- **search.query-string-bytes** - Maximum number of bytes in search query string. Default: `10240`
53+
54+
## Return
55+
56+
- `FT.CONFIG GET` returns an array with parameter names and their values in MAP format.
57+
- `FT.CONFIG SET` returns a simple string reply `OK` if executed correctly, or an error reply otherwise.
58+
- `FT.CONFIG HELP` returns an array of arrays, where each inner array contains 5 elements: parameter name, the string "Description", parameter description, the string "Value", and current value.
59+
60+
## Examples
61+
62+
<details open>
63+
<summary><b>Get all search configuration parameters</b></summary>
64+
65+
```bash
66+
dragonfly> FT.CONFIG GET *
67+
1) "MAXSEARCHRESULTS"
68+
2) "1000000"
69+
3) "search.query-string-bytes"
70+
4) "10240"
71+
```
72+
</details>
73+
74+
<details open>
75+
<summary><b>Set maximum search results</b></summary>
76+
77+
```bash
78+
dragonfly> FT.CONFIG SET MAXSEARCHRESULTS 500000
79+
OK
80+
```
81+
</details>
82+
83+
<details open>
84+
<summary><b>Get help for a specific parameter</b></summary>
85+
86+
```bash
87+
dragonfly> FT.CONFIG HELP MAXSEARCHRESULTS
88+
1) "MAXSEARCHRESULTS"
89+
2) "Description"
90+
3) "Maximum number of results from ft.search command"
91+
4) "Value"
92+
5) "500000"
93+
```
94+
</details>
95+
96+
<details open>
97+
<summary><b>Get a specific configuration parameter</b></summary>
98+
99+
```bash
100+
dragonfly> FT.CONFIG GET search.query-string-bytes
101+
1) "search.query-string-bytes"
102+
2) "10240"
103+
```
104+
</details>
105+
106+
<details open>
107+
<summary><b>Set query string size limit</b></summary>
108+
109+
```bash
110+
dragonfly> FT.CONFIG SET search.query-string-bytes 20480
111+
OK
112+
```
113+
</details>
114+
115+
<details open>
116+
<summary><b>Get help for all parameters</b></summary>
117+
118+
```bash
119+
dragonfly> FT.CONFIG HELP *
120+
1) 1) "MAXSEARCHRESULTS"
121+
2) "Description"
122+
3) "Maximum number of results from ft.search command"
123+
4) "Value"
124+
5) "1000000"
125+
2) 1) "search_query_string_bytes"
126+
2) "Description"
127+
3) "Maximum number of bytes in search query string"
128+
4) "Value"
129+
5) "10240"
130+
```
131+
</details>
132+
133+
## See also
134+
135+
[`FT.CREATE`](./ft.create.md) | [`FT.SEARCH`](./ft.search.md)
136+
137+
## Related topics
138+
139+
- [RediSearch](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/)

0 commit comments

Comments
 (0)