Skip to content

Fix FT.HYBRID COMBINE argument count to include YIELD_SCORE_AS tokens - #4575

Merged
ggivo merged 3 commits into
redis:masterfrom
guyroyse:fix/combiner-yield-score-count
Jun 26, 2026
Merged

ggivo merged 3 commits into
redis:masterfrom
guyroyse:fix/combiner-yield-score-count

Conversation

@guyroyse

@guyroyse guyroyse commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Combiner.addParams serializes the COMBINE <method> <count> clause using only the method-specific tokens (WINDOW/CONSTANT/ALPHA/BETA). When a combined-score alias is set via .as(...), the appended YIELD_SCORE_AS <alias> tokens fall outside that count, so Redis reads past the clause and rejects the command with YIELD_SCORE_AS: Unknown argument. Any hybrid query setting a combined-score alias fails.

For example, Combiners.rrf().window(20).constant(60).as("score") emitted:

COMBINE RRF 4 WINDOW 20 CONSTANT 60 YIELD_SCORE_AS score

when Redis expects the count to cover all six following tokens:

COMBINE RRF 6 WINDOW 20 CONSTANT 60 YIELD_SCORE_AS score

Fix

Include the two YIELD_SCORE_AS <alias> tokens in the count when an alias is present. Since addParams is final on the shared base Combiner, this covers both RRF and LINEAR combiners.

Tests

Adds CombinersTest with protocol-level serialization coverage for both combiners — each parameter alone and combined, the empty default, and the YIELD_SCORE_AS alias cases that regress this bug. Follows the existing CommandArgumentsMatchers idiom (hasArgumentCount / hasArguments). Verified the existing FTHybridRedisClientCommandsIT still passes against a live Redis.

Introduced by #4405.

Fixes #4574


Note

Low Risk
Small, targeted fix to search command serialization with broad unit and integration test coverage; no auth, data, or API contract changes beyond correcting broken hybrid queries that use .as(...).

Overview
Fixes FT.HYBRID hybrid queries that set a combined-score alias via Combiner.as(...). Redis expects the COMBINE <method> <count> count to cover every token in the clause, including YIELD_SCORE_AS and the alias; the client previously counted only method-specific args, so Redis treated those tokens as unknown arguments and rejected the command.

Combiner.addParams now adds 2 to the clause count when a score alias is present, so both LINEAR and RRF combiners serialize correctly.

Adds CombinersTest for command serialization (defaults, parameters, and alias cases) and a parameterized integration test in FTHybridCommandsTestBase that asserts the combined score is returned under the alias.

Reviewed by Cursor Bugbot for commit 1179422. Bugbot is set up for automated code reviews on this repo. Configure here.

Combiner.addParams wrote the COMBINE <method> <count> using only the
method-specific tokens (WINDOW/CONSTANT/ALPHA/BETA). When a combined-score
alias was set via .as(...), the two appended YIELD_SCORE_AS <alias> tokens
fell outside that count, so Redis read past the clause and rejected the
command with "YIELD_SCORE_AS: Unknown argument".

Count the two alias tokens when an alias is present. The fix lives in the
shared final addParams, so it covers both RRF and LINEAR combiners.

Add CombinersTest with protocol-level serialization coverage for both
combiners (each parameter alone and combined, plus the empty default) and
the YIELD_SCORE_AS alias cases that regress this bug.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jit-ci

jit-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

@ggivo ggivo added this to the 8.0.0 milestone Jun 26, 2026
@ggivo
ggivo merged commit 7fdb4e4 into redis:master Jun 26, 2026
18 checks passed
ggivo added a commit that referenced this pull request Jun 26, 2026
…ORE_AS (#4576)

Fix FT.HYBRID COMBINE argument count to include YIELD_SCORE_AS tokens (#4575)

* Fix FT.HYBRID COMBINE arg count to include YIELD_SCORE_AS tokens

Combiner.addParams wrote the COMBINE <method> <count> using only the
method-specific tokens (WINDOW/CONSTANT/ALPHA/BETA). When a combined-score
alias was set via .as(...), the two appended YIELD_SCORE_AS <alias> tokens
fell outside that count, so Redis read past the clause and rejected the
command with "YIELD_SCORE_AS: Unknown argument".

Count the two alias tokens when an alias is present. The fix lives in the
shared final addParams, so it covers both RRF and LINEAR combiners.

Add CombinersTest with protocol-level serialization coverage for both
combiners (each parameter alone and combined, plus the empty default) and
the YIELD_SCORE_AS alias cases that regress this bug.



* test: add FT.HYBRID YIELD_SCORE_AS integration test for RRF and LINEAR

* format

---------



(cherry picked from commit 7fdb4e4)

Co-authored-by: Guy Royse <guy@guy.dev>
mergify Bot added a commit to ArcadeData/arcadedb that referenced this pull request Jul 1, 2026
Bumps [redis.clients:jedis](https://github.com/redis/jedis) from 7.5.2 to 7.5.3.
Release notes

*Sourced from [redis.clients:jedis's releases](https://github.com/redis/jedis/releases).*

> 7.5.3
> -----
>
> This is a maintenance release with fixes for FT.HYBRID queries and connection pool handshake overhead. Recommended for any deployment using FT.HYBRID with `Combiner.as(...)` or `MultiDbClient`.
>
> 🐛 Bug Fixes
> -----------
>
> * Fixes `FT.HYBRID` `COMBINE` argument count omitting `YIELD_SCORE_AS` tokens, causing the command to be rejected when a combined-score alias is set via `Combiner.as(...)`. Fix by [`@​guyroyse`](https://github.com/guyroyse) in [redis/jedis#4575](https://redirect.github.com/redis/jedis/pull/4575), backported to `7.5.x` in [redis/jedis#4576](https://redirect.github.com/redis/jedis/pull/4576).
> * Fixes double initialization of a pooled `Connection` in `TrackingConnectionPool` (used by `MultiDbClient`). [redis/jedis#4547](https://redirect.github.com/redis/jedis/pull/4547), backported to `7.5.x` in <redis/jedis@dd42b3e>.
>
> **Full Changelog**: <redis/jedis@v7.5.2...v7.5.3>


Commits

* [`d0ca056`](redis/jedis@d0ca056) Add Redis 8.8 GA to test matrix on 7.5.x ([#4578](https://redirect.github.com/redis/jedis/issues/4578))
* [`2e73f17`](redis/jedis@2e73f17) Backport [#4571](https://redirect.github.com/redis/jedis/issues/4571) and [#4573](https://redirect.github.com/redis/jedis/issues/4573) to 7.5.x: stabilize XINFO STREAM tests ([#4577](https://redirect.github.com/redis/jedis/issues/4577))
* [`458bccf`](redis/jedis@458bccf) Backport [#4575](https://redirect.github.com/redis/jedis/issues/4575) to 7.5.x: fix FT.HYBRID COMBINE arg count for YIELD\_SCORE\_AS (...
* [`dd42b3e`](redis/jedis@dd42b3e) [7.5] Backport [#4547](https://redirect.github.com/redis/jedis/issues/4547): Fix double initialization of pooled Connection in Track...
* See full diff in [compare view](redis/jedis@v7.5.2...v7.5.3)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=redis.clients:jedis&package-manager=maven&previous-version=7.5.2&new-version=7.5.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FT.HYBRID COMBINE arg count omits YIELD_SCORE_AS tokens, command rejected when combined-score alias is set

2 participants