Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions docs/command-reference/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,18 @@ sidebar_position: 0
| | <span class="command">JSON.STRLEN</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">JSON.TOGGLE</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">JSON.TYPE</span> | <span class="support supported">Fully supported</span> |
| <span class="family">Search</span> | <span class="command">FT.CREATE</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.SEARCH</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.SYNUPDATE</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.SYNDUMP</span> | <span class="support supported">Fully supported</span> |
| <span class="family">Search</span> | <span class="command">FT.CREATE</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT.SEARCH</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT.ALTER</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.DROPINDEX</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT.INFO</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT._LIST</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.PROFILE</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT.AGGREGATE</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT.TAGVALS</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.SYNUPDATE</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.SYNDUMP</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.CONFIG</span> | <span class="support supported">Fully supported</span> |
| <span class="family">Auto Suggest</span> | <span class="command">TBD</span> | <span class="support unsupported">Unsupported</span> |
| <span class="family">T-Digest</span> | <span class="command">TBD</span> | <span class="support unsupported">Unsupported</span> |
| <span class="family">Time Series</span> | <span class="command">TBD</span> | <span class="support unsupported">Unsupported</span> |
Expand Down
135 changes: 135 additions & 0 deletions docs/command-reference/search/ft.aggregate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
description: Runs a search query and performs aggregate transformations
---

# FT.AGGREGATE

## Syntax

FT.AGGREGATE index query
[LOAD count field [field ...]]
[GROUPBY nargs property [property ...] [REDUCE function nargs arg [arg ...]] [REDUCE function nargs arg [arg ...]]]
[SORTBY nargs property [ASC|DESC] [property [ASC|DESC] ...] [MAX num]]
[LIMIT offset num]
[PARAMS nargs name value [name value ...]]

**Time complexity:** O(N)

## Description

Run a search query and perform aggregate transformations on the results.

This command provides aggregation functionality similar to SQL GROUP BY operations, allowing you to group search results and apply reduction functions.

## Required arguments

<details open>
<summary><code>index</code></summary>

is index name. You must first create the index using [`FT.CREATE`](./ft.create.md).
</details>

<details open>
<summary><code>query</code></summary>

is text query to search. If it's more than a single word, put it in quotes.
Refer to [query syntax](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/) for more details.
</details>

## Optional arguments

<details open>
<summary><code>LOAD count field [field ...]</code></summary>

loads additional fields from the document that are not part of the index.

`count` is the number of fields to load.
`field` is the field name to load from the document.
</details>

<details open>
<summary><code>GROUPBY nargs property [property ...] [REDUCE ...]</code></summary>

groups the results according to one or more properties.

`nargs` is the number of properties to group by.
`property` is the property name to group by.

Optionally followed by one or more `REDUCE` clauses that aggregate the grouped results.
</details>

<details open>
<summary><code>REDUCE function nargs arg [arg ...]</code></summary>

applies an aggregate function to the grouped results.

Common functions include:
- `COUNT` - counts the number of records in each group
- `SUM property` - sums the values of the given property
- `MIN property` - finds minimum value
- `MAX property` - finds maximum value
- `AVG property` - calculates average value
- `STDDEV property` - calculates standard deviation

</details>

<details open>
<summary><code>SORTBY nargs property [ASC|DESC] [property [ASC|DESC] ...] [MAX num]</code></summary>

sorts the results by the given properties.

`nargs` is the number of properties to sort by.
`property` is the property name to sort by.
`ASC|DESC` specifies sort order (default is ASC).
`MAX num` limits the number of results.
</details>

<details open>
<summary><code>LIMIT offset num</code></summary>

limits the results to the offset and number of results given.

The offset is zero-indexed. Default is 0 10.
</details>

<details open>
<summary><code>PARAMS nargs name value [name value ...]</code></summary>

defines one or more value parameters that can be referenced in the query.

Similar to [`FT.SEARCH`](./ft.search.md) PARAMS option.
</details>

## Return

`FT.AGGREGATE` returns an array reply with aggregated results based on the specified grouping and reduction operations.

:::info Limited support
FT.AGGREGATE has partial support in Dragonfly. Some advanced aggregation functions and options may not be fully implemented.
:::

## Examples

<details open>
<summary><b>Group results by category and count</b></summary>

```bash
dragonfly> FT.AGGREGATE products "*" GROUPBY 1 @category REDUCE COUNT 0 AS count
```
</details>

<details open>
<summary><b>Calculate average price by category</b></summary>

```bash
dragonfly> FT.AGGREGATE products "*" GROUPBY 1 @category REDUCE AVG 1 @price AS avg_price
```
</details>

## See also

[`FT.SEARCH`](./ft.search.md) | [`FT.CREATE`](./ft.create.md)

## Related topics

- [RediSearch](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/)
93 changes: 93 additions & 0 deletions docs/command-reference/search/ft.config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
description: Configure search engine at runtime
---

# FT.CONFIG

## Syntax

FT.CONFIG GET pattern
FT.CONFIG SET option value
FT.CONFIG HELP [option]

**Time complexity:** O(1)

## Description

Configure search engine at runtime.

## Required arguments

<details open>
<summary><code>GET pattern</code></summary>

returns the current values of configuration parameters matching the given pattern.

`pattern` is a glob-style pattern for the configuration parameter names.
</details>

<details open>
<summary><code>SET option value</code></summary>

sets a configuration parameter to the given value.

`option` is the configuration parameter name.
`value` is the new value for the configuration parameter.
</details>

<details open>
<summary><code>HELP [option]</code></summary>

returns help information about configuration parameters.

If `option` is specified, returns help for that specific parameter.
If no option is given, returns help for all available parameters.
</details>

## Return

- `FT.CONFIG GET` returns an array with parameter names and their values.
- `FT.CONFIG SET` returns a simple string reply `OK` if executed correctly, or an error reply otherwise.
- `FT.CONFIG HELP` returns an array with parameter information including descriptions and current values.

## Examples

<details open>
<summary><b>Get all search configuration parameters</b></summary>

```bash
dragonfly> FT.CONFIG GET *
1) "MAXSEARCHRESULTS"
2) "1000000"
```
</details>

<details open>
<summary><b>Set maximum search results</b></summary>

```bash
dragonfly> FT.CONFIG SET MAXSEARCHRESULTS 500000
OK
```
</details>

<details open>
<summary><b>Get help for a specific parameter</b></summary>

```bash
dragonfly> FT.CONFIG HELP MAXSEARCHRESULTS
1) "MAXSEARCHRESULTS"
2) "Description"
3) "Maximum number of results from ft.search command"
4) "Value"
5) "500000"
```
</details>

## See also

[`FT.CREATE`](./ft.create.md) | [`FT.SEARCH`](./ft.search.md)

## Related topics

- [RediSearch](https://redis.io/docs/stack/search)
52 changes: 47 additions & 5 deletions docs/command-reference/search/ft.create.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ description: Creates an index with the given spec
FT.CREATE index
[ON HASH | JSON]
[PREFIX count prefix [prefix ...]]
SCHEMA field_name [AS alias] TEXT | TAG | NUMERIC | VECTOR [ SORTABLE ]
[NOINDEX] [ field_name [AS alias] TEXT | TAG | NUMERIC | VECTOR [ SORTABLE ] [NOINDEX] ...]
[STOPWORDS count [words...]]
SCHEMA field_name [AS alias] TEXT | TAG | NUMERIC | VECTOR | GEO [ SORTABLE ]
[NOINDEX] [ field_name [AS alias] TEXT | TAG | NUMERIC | VECTOR | GEO [ SORTABLE ] [NOINDEX] ...]

**Time complexity:** O(K) at creation where K is the number of fields, O(N) if scanning the keyspace is triggered, where N is the number of keys in the keyspace.

Expand Down Expand Up @@ -43,17 +44,24 @@ after the SCHEMA keyword, declares which fields to index:

Field types are:

- `TEXT` - Allows searching for words against the text value in this attribute.
- `TEXT [WITHSUFFIXTRIE]` - Allows searching for words against the text value in this attribute.
* `WITHSUFFIXTRIE` - builds a suffix trie for efficient suffix and infix queries.

- `TAG` - Allows exact-match queries, such as categories or primary keys, against the value in this attribute.
- `TAG [SEPARATOR {char}] [CASESENSITIVE] [WITHSUFFIXTRIE]` - Allows exact-match queries, such as categories or primary keys, against the value in this attribute.
* `SEPARATOR {char}` - indicates how text is split into individual tags. Default is `,`.
* `CASESENSITIVE` - preserve original case for tags. Default is case insensitive.
* `WITHSUFFIXTRIE` - builds a suffix trie for efficient suffix and infix queries.
For more information, see [tag fields](https://redis.io/docs/interact/search-and-query/advanced-concepts/tags/).

- `NUMERIC` - Allows numeric range queries against the value in this attribute.
- `NUMERIC [BLOCKSIZE {size}]` - Allows numeric range queries against the value in this attribute.
* `BLOCKSIZE {size}` - block size for the range tree data structure. Default is optimized based on data size.
See [query syntax](https://redis.io/docs/interact/search-and-query/query/) for details on how to use numeric ranges.

- `VECTOR` - Allows vector similarity queries against the value in this attribute.
For more information, see [vector fields](https://redis.io/docs/interact/search-and-query/search/vectors/).

- `GEO` - Allows geographic range queries against the value in this attribute.

:::note About `VECTOR`
- Full documentation on vector options is available [here](https://redis.io/docs/interact/search-and-query/advanced-concepts/vectors/).
- Currently, Dragonfly has limited support for vector options.
Expand All @@ -75,6 +83,13 @@ Dragonfly does **not** support sorting without the `SORTABLE` option.

- `NOINDEX` - Attributes can have the `NOINDEX` option, which means they will not be indexed. This is useful in conjunction with `SORTABLE`, to create attributes whose update using PARTIAL will not cause full reindexing of the document. If an attribute has NOINDEX and doesn't have SORTABLE, it will just be ignored by the index.

:::note About ignored field options
The following field options are accepted but ignored for compatibility with Redis:
- `UNF`, `NOSTEM` - ignored without arguments
- `WEIGHT`, `PHONETIC` - ignored with their arguments
- `INDEXMISSING`, `INDEXEMPTY` - ignored without warning
:::

</details>

## Optional arguments
Expand All @@ -99,6 +114,18 @@ Currently, Dragonfly supports only one prefix (i.e., `PREFIX 1 my_prefix`), if t
:::
</details>

<a name="STOPWORDS"></a>
<details open>
<summary><code>STOPWORDS count [words...]</code></summary>

sets the index's stopword list to the given list of stopwords.
Stopwords are common words (like "the", "a", "is") that are typically ignored during indexing and searching.

If `count` is 0, the index will have no stopwords.
If `count` is greater than 0, the following `count` arguments will be treated as stopwords.

</details>

## Return

`FT.CREATE` returns a simple string reply `OK` if executed correctly, or an error reply otherwise.
Expand All @@ -119,6 +146,21 @@ Index the `sku` attribute from a hash as both a `TEXT` and as `TAG`:

``` bash
dragonfly> FT.CREATE idx ON HASH PREFIX 1 blog:post: SCHEMA sku AS sku_text TEXT sku AS sku_tag TAG SORTABLE
OK
```

Create an index with custom TAG separator and case-sensitive matching:

``` bash
dragonfly> FT.CREATE products_idx ON HASH PREFIX 1 product: SCHEMA categories TAG SEPARATOR "|" CASESENSITIVE SORTABLE price NUMERIC BLOCKSIZE 64 description TEXT WITHSUFFIXTRIE
OK
```

Create an index with custom stopwords:

``` bash
dragonfly> FT.CREATE articles_idx ON HASH PREFIX 1 article: STOPWORDS 3 the a is SCHEMA title TEXT content TEXT NOINDEX
OK
```

</details>
Expand Down
4 changes: 4 additions & 0 deletions docs/command-reference/search/ft.dropindex.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ description: Deletes the index

Delete an index.

:::info Future functionality
The `DD` (delete documents) option is planned for future releases but is not currently implemented in Dragonfly.
:::

## Required arguments

<details open>
Expand Down
Loading