-
Notifications
You must be signed in to change notification settings - Fork 10
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
EREGCSC-2687 Fix for items with identical ranks being sorted in an undefined way #1528
Merged
Conversation
This file contains 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
✨ See the Django Site in action ✨ |
✨ See the Django Site in action ✨ |
PhilR8
approved these changes
Jan 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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.
Resolves #2687
Description-
A while back we noticed an issue where differing page sizes would be sorted differently. Today a bug popped up where two nearly identical searches are being sorted differently. The only difference was that
show_internal
andshow_regulations
were both changed from true to false, as public items were always first in this particular search.Noticed that the items in question had identical ranks (0.9999997) and realized that we are only sorting by rank and not specifying a secondary sort parameter for items with identical rank.
This PR fixes this (for now) by changing
order_by("-rank")
toorder_by("-rank", "-id")
. In theory this is a good approximation of sort by date as larger IDs should represent newer documents. In the future, we need to find a way to represent a date field in the Content Index model so we can do a proper sort by date for all Resource subtypes, but not Reg Text.This pull request changes...
-id
to the search resultorder_by
, after-rank
.Steps to manually verify this change...
managed care SNP
, and take note of the first few items which are all "public" resources.