Repository navigation
Fix flaky RsSearchTest score parsing for FT.SEARCH results - #97
Merged
Merged
Conversation
BM25 scores are fractional floats, but score: used asInteger which truncated values like 0.28 to 0 and failed score > 0 assertions on CI. Replace fixed-size chunk parsing with stream-based loading that handles both nested and flat Redis reply layouts for WITHSCORES/WITHPAYLOADS/ WITHSORTKEYS combinations. Co-authored-by: Masashi Umezawa <mumez@users.noreply.github.com>
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.
Problem
CI run 34097596917 failed on Pharo64-12 with:
Root cause
Two issues in search result parsing:
RsSearchResult>>score:usedasInteger— BM25 scores from RediSearch are fractional floats (e.g.0.287682...). Converting viaasIntegertruncates to0, causingscore > 0to fail intermittently depending on how the Redis client returns the value (String vs Float).RsSearchResultSetused fixed-size chunk parsing — WithWITHSCORES,WITHPAYLOADS, andWITHSORTKEYS, the reply layout is variable-length (nested content array vs flat field/value pairs). A fixed chunk size of 5 misaligned fields under some reply formats.Fix
asNumberto correctly handle fractional BM25 values.Testing
Verified locally on Pharo64-11, Pharo64-12, and Pharo64-13:
#testSearchWithOptionsSimpleHashespasses consistently across multiple runs on Pharo64-12 (the CI version that failed).