Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOD-7206: [2.6] Fix sorting multiple fields #4717

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

GuyAv46
Copy link
Collaborator

@GuyAv46 GuyAv46 commented Jun 6, 2024

Describe the changes in the pull request

Fixing sorting by multiple keys, when the two rows are missing the primary(s) key(s) but hold a value for secondary(s).

Consider the case where doc1 = {docID = 1, n = 93}, doc2 = {docID = 2, n = 46}.
We want to sort by a missing field as the primary sort, and by n as a secondary.
... SORTBY 2 @missing @n ...
Since both are missing a value for missing, we should treat them as equals and continue to compare them according to the secondary n key. We get that doc2 is the first and doc1 is the second (doc1.n > doc2.n)

Before the fix, we would see that they both are missing missing and we will immediately fall back to comparing them by docID (our last resort). In this case we get that doc1 is the first and doc2 is the second (doc1.docID < doc2.docID)

Which issues this PR fixes

  1. [BUG] FT.AGGREGATE Inconsistent Multi-Sorting in Redis 6.0.20 with RedisSearch v2.6.12 #4711
  2. sorter simplification #3501 - Original fix for master, affecting 2.8 and forward
  3. MOD-7206

Only relevant for the 2.6 branch.

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

@GuyAv46 GuyAv46 added the bug label Jun 6, 2024
@GuyAv46 GuyAv46 enabled auto-merge June 6, 2024 16:29
Copy link

codecov bot commented Jun 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.65%. Comparing base (8ffd0a3) to head (8222de5).

Additional details and impacted files
@@            Coverage Diff             @@
##              2.6    #4717      +/-   ##
==========================================
- Coverage   83.65%   83.65%   -0.01%     
==========================================
  Files         176      176              
  Lines       31147    31146       -1     
==========================================
- Hits        26057    26056       -1     
  Misses       5090     5090              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GuyAv46 GuyAv46 added this pull request to the merge queue Jun 6, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 6, 2024
@GuyAv46 GuyAv46 added this pull request to the merge queue Jun 6, 2024
Merged via the queue into 2.6 with commit 29fbed5 Jun 6, 2024
11 checks passed
@GuyAv46 GuyAv46 deleted the guyav-fix_sorting_multiple_fields branch June 6, 2024 19:08
@GuyAv46 GuyAv46 changed the title Fix sorting multiple fields Fix sorting multiple fields - [MOD-7206] Jun 7, 2024
@oshadmi oshadmi changed the title Fix sorting multiple fields - [MOD-7206] MOD-7206: [2.6] Fix sorting multiple fields Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants