fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
801a05d
)
search fix
author
Radek Czajka
<rczajka@rczajka.pl>
Mon, 5 Jun 2023 11:13:26 +0000
(13:13 +0200)
committer
Radek Czajka
<rczajka@rczajka.pl>
Mon, 5 Jun 2023 11:13:52 +0000
(13:13 +0200)
src/search/forms.py
patch
|
blob
|
history
diff --git
a/src/search/forms.py
b/src/search/forms.py
index
f3bf0c0
..
1e680fa
100644
(file)
--- a/
src/search/forms.py
+++ b/
src/search/forms.py
@@
-3,7
+3,7
@@
#
from django.apps import apps
from django.conf import settings
#
from django.apps import apps
from django.conf import settings
-from django.contrib.postgres.search import SearchHeadline, Search
Rank, Search
Query
+from django.contrib.postgres.search import SearchHeadline, SearchQuery
from django import forms
from django.utils.translation import gettext_lazy as _
from catalogue.constants import LANGUAGES_3TO2
from django import forms
from django.utils.translation import gettext_lazy as _
from catalogue.constants import LANGUAGES_3TO2
@@
-165,9
+165,7
@@
class SearchFilters(forms.Form):
).filter(search_vector=squery)
books = books.exclude(ancestor__in=books)
).filter(search_vector=squery)
books = books.exclude(ancestor__in=books)
- snippets = qs['snippet'].annotate(
- rank=SearchRank('search_vector', squery)
- ).filter(rank__gt=0).order_by('-rank').annotate(
+ snippets = qs['snippet'].filter(search_vector=squery).annotate(
headline=SearchHeadline(
'text',
query,
headline=SearchHeadline(
'text',
query,