feat(search): add COLLECT reducer to FT.AGGREGATE - #3310
Merged
Merged
Conversation
nkaradzhov
force-pushed
the
collect-aggregate
branch
from
June 22, 2026 09:30
5c13988 to
25904dd
Compare
PavelPashov
reviewed
Jun 22, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 8a7ece9. Configure here.
nkaradzhov
force-pushed
the
collect-aggregate
branch
from
June 22, 2026 14:10
8a7ece9 to
25904dd
Compare
PavelPashov
approved these changes
Jun 22, 2026
PavelPashov
self-requested a review
June 22, 2026 14:27
Support the experimental COLLECT reducer (Redis Search 8.8), which fetches whole documents or projected fields within each GROUPBY group, with optional DISTINCT, in-group SORTBY, and LIMIT. - FIELDS '*' emits a bare wildcard token; an explicit list is count-prefixed - nargs is computed dynamically via pushVariadicWithLength (unlike the fixed-narg reducers), covering FIELDS/DISTINCT/SORTBY/LIMIT - reuses pushSortByProperty for the nested SORTBY clause - HYBRID picks up COLLECT automatically (shared parseGroupByReducer) Tests: arg-serialization specs plus an integration test gated behind a new OPEN_UNSTABLE server config (--search-enable-unstable-features yes), required because COLLECT is rejected when unstable features are off. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
COLLECT reducer is only available on RediSearch >= 8.8 (behind --search-enable-unstable-features). Older matrix servers (7.4/8.2/8.4) reject it with "No such reducer: COLLECT". Gate the live test with minimumDockerVersion so it skips on those and runs on 8.8. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nkaradzhov
force-pushed
the
collect-aggregate
branch
from
July 6, 2026 12:36
25904dd to
276f051
Compare
…8.10 DISTINCT is now merged in RediSearch and confirmed live in the 8.10 test image. Add an integration test asserting DISTINCT collapses duplicate projected fields within a group. Both COLLECT integration tests are gated to server >= 8.10 (the version verified to expose the reducer) and kept behind OPEN_UNSTABLE, since COLLECT is still rejected on 8.10 when unstable features are off. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nkaradzhov
force-pushed
the
collect-aggregate
branch
from
July 6, 2026 12:44
276f051 to
86098fa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Support the experimental COLLECT reducer (Redis Search 8.8), which fetches whole documents or projected fields within each GROUPBY group, with optional DISTINCT, in-group SORTBY, and LIMIT.
Description
Checklist
npm testpass with this change (including linting)?Note
Low Risk
Additive API and command encoding for an optional reducer; existing reducers unchanged, with coverage focused on argument transformation and opt-in unstable server tests.
Overview
Adds client support for the experimental COLLECT
GROUPBYreducer onFT.AGGREGATE, so callers can gather full documents or selected fields per group with optional DISTINCT, in-group SORTBY, LIMIT, and AS aliases.parseGroupByReducernow serializes COLLECT with dynamic nargs viapushVariadicWithLength(wildcardFIELDS *vs count-prefixed field lists, plus optional clauses). HYBRID inherits COLLECT through the shared reducer parser. Tests add transform coverage and integration runs againstOPEN_UNSTABLE(Redis 8.10+ with unstable search features).Reviewed by Cursor Bugbot for commit 86098fa. Bugbot is set up for automated code reviews on this repo. Configure here.