From e599c80f53fccaf500d7dc447c9b23e679acad73 Mon Sep 17 00:00:00 2001 From: "David W. Dougherty" Date: Tue, 2 Dec 2025 10:01:43 -0800 Subject: [PATCH 1/2] DEV: add info about WITHOUTCOUNT parameter --- content/commands/ft.aggregate.md | 4 +++- content/commands/ft.search.md | 4 ++-- .../develop/ai/search-and-query/advanced-concepts/dialects.md | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/content/commands/ft.aggregate.md b/content/commands/ft.aggregate.md index 08d98db973..3b8364a4f7 100644 --- a/content/commands/ft.aggregate.md +++ b/content/commands/ft.aggregate.md @@ -183,7 +183,7 @@ syntax: "FT.AGGREGATE index query \n [VERBATIM] \n [LOAD count field [field .. \ \n [TIMEOUT timeout] \n [GROUPBY nargs property [property ...] [REDUCE function\ \ nargs arg [arg ...] [AS name] [REDUCE function nargs arg [arg ...] [AS name]\ \ ...]] ...]] \n [SORTBY nargs [property ASC | DESC [property ASC | DESC ...]]\ - \ [MAX num] [WITHCOUNT] \n [APPLY expression AS name [APPLY expression AS name\ + \ [MAX num] [WITHCOUNT | WITHOUTCOUNT]] \n [APPLY expression AS name [APPLY expression AS name\ \ ...]] \n [LIMIT offset num] \n [FILTER filter] \n [WITHCURSOR [COUNT read_size]\ \ [MAXIDLE idle_time]] \n [PARAMS nargs name value [name value ...]] \n [SCORER scorer]\n \ [ADDSCORES] \n [DIALECT\ @@ -282,6 +282,8 @@ Attributes needed for `SORTBY` should be stored as `SORTABLE` to be available wi **Counts behavior**: optional `WITHCOUNT` argument returns accurate counts for the query results with sorting. This operation processes all results in order to get an accurate count, being less performant than the optimized option (default behavior on `DIALECT 4`) +You can also use `WITHOUTCOUNT` in place of `DIALECT 4` when used with either `FT.SEARCH` or `FT.AGGREGATE`. +
APPLY {expr} AS {name} diff --git a/content/commands/ft.search.md b/content/commands/ft.search.md index 1decc82c9a..4ef4f8aac8 100644 --- a/content/commands/ft.search.md +++ b/content/commands/ft.search.md @@ -288,7 +288,7 @@ syntax: "FT.SEARCH index query \n [NOCONTENT] \n [VERBATIM] \n [NOSTOPWORDS] \ [ FIELDS count field [field ...]] [ TAGS open close]] \n [SLOP slop] \n [TIMEOUT\ \ timeout] \n [INORDER] \n [LANGUAGE language] \n [EXPANDER expander] \n [SCORER\ \ scorer] \n [EXPLAINSCORE] \n [PAYLOAD payload] \n [SORTBY sortby [ ASC | DESC]\ - \ [WITHCOUNT]] \n [LIMIT offset num] \n [PARAMS nargs name value [ name value\ + \ [WITHCOUNT | WITHOUTCOUNT]] \n [LIMIT offset num] \n [PARAMS nargs name value [ name value\ \ ...]] \n [DIALECT dialect]\n" syntax_fmt: "FT.SEARCH index query [NOCONTENT] [VERBATIM] [NOSTOPWORDS]\n [WITHSCORES]\ \ [WITHPAYLOADS] [WITHSORTKEYS] [FILTER\_numeric_field\n min max [FILTER\_numeric_field\ @@ -485,7 +485,7 @@ orders the results by the value of this attribute. This applies to both text and **Counts behavior**: optional`WITHCOUNT`argument returns accurate counts for the query results with sorting. This operation processes all results in order to get an accurate count, being less performant than the optimized option (default behavior on `DIALECT 4`) - +You can also use `WITHOUTCOUNT` in place of `DIALECT 4` when used with either `FT.SEARCH` or `FT.AGGREGATE`.
diff --git a/content/develop/ai/search-and-query/advanced-concepts/dialects.md b/content/develop/ai/search-and-query/advanced-concepts/dialects.md index 95cfee3d2c..e1814a56ec 100644 --- a/content/develop/ai/search-and-query/advanced-concepts/dialects.md +++ b/content/develop/ai/search-and-query/advanced-concepts/dialects.md @@ -208,6 +208,8 @@ Dialect version 4 will improve performance in four different scenarios: 1. **Hybrid** - applied when there is a `SORTBY` on a numeric field in addition to another non-numeric filter. It could be the case that some results will get filtered, leaving too small a range to satisfy any specified `LIMIT`. In such cases, the iterator then is re-wound and additional iterations occur to collect result up to the requested `LIMIT`. 1. **No optimization** - If there is a sort by score or by a non-numeric field, there is no other option but to retrieve all results and compare their values to the search parameters. +You can also use `WITHOUTCOUNT` in place of `DIALECT 4` when used with either FT.SEARCH or FT.AGGREGATE. + ## Use `FT.EXPLAINCLI` to compare dialects The [`FT.EXPLAINCLI`]({{< relref "commands/ft.explaincli/" >}}) command is a powerful tool that provides a window into the inner workings of your queries. It's like a roadmap that details your query's journey from start to finish. From 66ea15c95c327ee8c197851bb2559d0ffe819087 Mon Sep 17 00:00:00 2001 From: David Dougherty Date: Tue, 2 Dec 2025 10:58:18 -0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: mich-elle-luna <153109578+mich-elle-luna@users.noreply.github.com> --- content/commands/ft.search.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/commands/ft.search.md b/content/commands/ft.search.md index 4ef4f8aac8..b7b7a62610 100644 --- a/content/commands/ft.search.md +++ b/content/commands/ft.search.md @@ -483,7 +483,7 @@ orders the results by the value of this attribute. This applies to both text and - Hybrid - applied when there is a `SORTBY` clause over a numeric field and another non-numeric filter. Some results will get filtered, and the initial range may not be large enough. The iterator is then rewinding with the following ranges, and an additional iteration takes place to collect the `LIMIT` requested results. - No optimization - If there is a sort by score or by non-numeric field, there is no other option but to retrieve all results and compare their values. -**Counts behavior**: optional`WITHCOUNT`argument returns accurate counts for the query results with sorting. This operation processes all results in order to get an accurate count, being less performant than the optimized option (default behavior on `DIALECT 4`) +**Counts behavior**: optional `WITHCOUNT` argument returns accurate counts for the query results with sorting. This operation processes all results in order to get an accurate count, being less performant than the optimized option (default behavior on `DIALECT 4`) You can also use `WITHOUTCOUNT` in place of `DIALECT 4` when used with either `FT.SEARCH` or `FT.AGGREGATE`.