Skip to content

Commit

Permalink
search: Disable promoted results, as it's broken in recent wagtail
Browse files Browse the repository at this point in the history
(and there's currently none in the datbase)
  • Loading branch information
Bjwebb committed Sep 9, 2024
1 parent f666484 commit a522c40
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions search/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,19 @@ def serve(self, request, page=None):
for r in m.objects.live().public().search(search_query).annotate_score('_score')]
search_results = sorted(search_results, key=lambda x: x._score, reverse=True)

promoted = [x.page.specific for x in Query.get(search_query).editors_picks.all() if x.page.live]
promoted_page_ids = [promoted_page.id for promoted_page in promoted]
filtered_search_results = [result for result in search_results if result.id not in promoted_page_ids]
# These don't work with recent wagtail,
# but there's currently no editors picks in the database,
# so disable for now.
# promoted = [x.page.specific for x in Query.get(search_query).editors_picks.all() if x.page.live]
# promoted_page_ids = [promoted_page.id for promoted_page in promoted]
# filtered_search_results = [result for result in search_results if result.id not in promoted_page_ids]

query = Query.get(search_query)
query.add_hit()

results = list(chain(promoted, filtered_search_results))
# Disabled, see above
# results = list(chain(promoted, filtered_search_results))
results = search_results

else:
results = Page.objects.none()
Expand Down

0 comments on commit a522c40

Please sign in to comment.