From: Radek Czajka Date: Mon, 5 Jun 2023 12:41:52 +0000 (+0200) Subject: search fix X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/4668015907cd146c6607ba4a14611f4ea7ffe617?ds=sidebyside;hp=8f031335a8a0dabceec381b89eb0cbbcb2f4b637 search fix --- diff --git a/src/search/forms.py b/src/search/forms.py index edbc9d3b2..176c73ee8 100644 --- a/src/search/forms.py +++ b/src/search/forms.py @@ -104,14 +104,14 @@ class SearchFilters(forms.Form): qs['pdbook'] = qs['pdbook'].none() if c != 'quote': qs['snippet'] = qs['snippet'].none() if c != 'art': qs['art'] = qs['art'].none() - qs['art'] = Picture.objects.none() + qs['art'] = picture.models.Picture.objects.none() if self.cleaned_data['format']: c = self.cleaned_data['format'] qs['author'] = qs['author'].none() qs['pdauthor'] = qs['pdauthor'].none() qs['theme'] = qs['theme'].none() - qs['genre'] = qs['genrer'].none() + qs['genre'] = qs['genre'].none() qs['collection'] = qs['collection'].none() if c == 'art': qs['book'] = qs['book'].none() @@ -163,7 +163,7 @@ class SearchFilters(forms.Form): books = qs['book'].annotate( search_vector=UnaccentSearchVector('title') ).filter(search_vector=squery) - books = books.exclude(ancestor__in=books) + books = books.exclude(ancestor__in=books).order_by('-popularity__count') snippets = qs['snippet'].filter(search_vector=squery).annotate( headline=SearchHeadline( @@ -172,9 +172,8 @@ class SearchFilters(forms.Form): config='polish', start_sel='', stop_sel='', - highlight_all=True ) - )[:100] + ).order_by('-book__popularity__count', 'sec')[:100] snippets_by_book = {} for snippet in snippets: snippet_list = snippets_by_book.setdefault(snippet.book, []) diff --git a/src/search/templates/search/results.html b/src/search/templates/search/results.html index 189d095e2..dbd0d6ffd 100644 --- a/src/search/templates/search/results.html +++ b/src/search/templates/search/results.html @@ -134,7 +134,6 @@
{% for collection in results.collection %} {% include 'catalogue/2022/collection_box.html' %} - {% include 'catalogue/2022/collection_box.html' %} {% endfor %}