Fix for #493#504
Open
tim-band wants to merge 2 commits into
Open
Conversation
tcouch
approved these changes
Jun 25, 2026
| # All these objects are returned | ||
| self.assertSetEqual(set(results2), {a2, w2, f2}) | ||
| # And the antiquarian is not first | ||
| self.assertNotEqual(results2[0], a2) |
Collaborator
There was a problem hiding this comment.
Nice explanation, but I don't think you'd want to assert that antiquarians should explicitly not come first if the match is to its intro instead of its name. If it doesn't matter to us what the order is, I wouldn't test for it.
| ) -> QuerySet: | ||
| """ | ||
| Get the queryset for matching one type of objects, without Latin folding, | ||
| with extra weight (so they appear at the top of the) |
Collaborator
There was a problem hiding this comment.
At the top of the...? Please, I need to know! :-)
| ("name", terms.match_heavy), | ||
| ("plain_introduction", terms.match), | ||
| ("re_code", terms.match), | ||
| ("re_code", terms.match_heavy), |
Collaborator
There was a problem hiding this comment.
I could take or leave re_code being match_heavy - as far as I can tell it doesn't tend to contain anything the name doesn't have. Although that raises the question of why it's even a search field anyway.
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.
Antiquarian name matches come higher in search results.
I have annotated each object in the results set with a
weightinteger. Normally this is 1, but I have a new matcher functionmatch_heavythat sets it to 100 (giving us plenty of room for intermediate weights; although there's no problem renumbering at any time I suppose).Fixes #493