Repository navigation
Count YIELD_SCORE_AS tokens in FT.HYBRID COMBINE clause #3811 - #3832
Merged
a-TODO-rov merged 2 commits intoJul 10, 2026
Merged
Conversation
The clause count left out the YIELD_SCORE_AS pair, so Redis rejected any hybrid query that set a combined-score alias.
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.
Make sure that:
mvn formatter:formattarget.Combiners.rrf().window(20).constant(60).as("score")serializes the COMBINE clause asRRF 4 WINDOW 20 CONSTANT 60 YIELD_SCORE_AS score, but that count only covers the four combiner params. TheYIELD_SCORE_AS scorepair falls outside it, so Redis rejects the command as an unknown argument. Any hybrid query that sets a score alias is broken.The count is written in
Combiner.build()before the alias is appended, so I add the two tokens when an alias is set. It's on thefinalbase, so RRF and LINEAR both pick it up. Jedis fixed the twin issue the same way (redis/jedis#4575).This is
@Experimental, so one to confirm: the fix assumes the count has to includeYIELD_SCORE_ASto match how the server parses the clause. If you'd prefer an integration test against a live Redis too, I'll add one.Heads up: #3831 opened for the same issue while I was wrapping this up. I put mine together independently and it mirrors the Jedis fix, so I'm sending it as an alternative. Glad to defer to whichever you'd rather take.
closes #3811
Note
Low Risk
Narrow serialization fix in experimental hybrid search command building, with unit and integration coverage and no change when no score alias is used.
Overview
Fixes broken
FT.HYBRIDCOMBINE clauses when a combined score alias is set viaCombiners.*.as(...). Redis expects the numeric token count afterRRF/LINEARto cover every following combiner argument, including theYIELD_SCORE_AS+ alias pair; previously only combiner params (e.g.WINDOW,CONSTANT) were counted, so the server treated the alias as an invalid extra argument.Combiner.build()now adds 2 to that count whenscoreAliasis set, which applies to both RRF and LINEAR through the shared base class. Unit tests lock the serialized command strings for alias and no-alias cases; the hybrid integration test uses.as("combined_score")on the combiner and assertscombined_score,text_score, andvector_scoreappear in results.Reviewed by Cursor Bugbot for commit 5fac5ec. Bugbot is set up for automated code reviews on this repo. Configure here.