Skip to content

Commit

Permalink
Order results by match ranking on Postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
vrigal committed Mar 26, 2024
1 parent fb5ae32 commit 3b40e92
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/sample_data/bug_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
{
"status": "NEW",
"id": 1054669,
"summary": "Intermittent test_switch_frame.py TestSwitchFrame.test_should_be_able_to_carry_on_working_if_the_frame_is_deleted_from_under_us | TimeoutException: TimeoutException: Connection timed out",
"summary": "Intermittent test_switch_frame.py TestSwitchFrame.test_should_be_able_to_carry_on_working_if_the_frame_is_deleted_from_under_us | TimeoutException",
"dupe_of": null,
"duplicates": [],
"cf_crash_signature": "",
Expand Down
2 changes: 1 addition & 1 deletion treeherder/model/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def search(cls, search_term):
recent_qs = (
Bugscache.objects.filter(summary__icontains=search_term)
.annotate(similarity=TrigramSimilarity("summary", search_term))
.order_by("similarity")[0:max_size]
.order_by("-similarity")[0:max_size]
)

exclude_fields = ["modified", "processed_update"]
Expand Down

0 comments on commit 3b40e92

Please sign in to comment.