Update umap/views.py

Co-authored-by: Adrien nayrat <adrien.nayrat@gmail.com>
This commit is contained in:
Yohan Boniface 2023-05-10 19:24:33 +02:00 committed by GitHub
parent 7384fda61a
commit 005a759b81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -192,7 +192,7 @@ class Search(TemplateView, PaginatorMixin):
if q: if q:
where = "to_tsvector(name) @@ websearch_to_tsquery(%s)" where = "to_tsvector(name) @@ websearch_to_tsquery(%s)"
if getattr(settings, "UMAP_USE_UNACCENT", False): if getattr(settings, "UMAP_USE_UNACCENT", False):
where = "to_tsvector(unaccent(name)) @@ websearch_to_tsquery(unaccent(%s))" # noqa where = "to_tsvector('umapdict',name) @@ websearch_to_tsquery('umapdict',%s)" # noqa
results = Map.objects.filter(share_status=Map.PUBLIC) results = Map.objects.filter(share_status=Map.PUBLIC)
results = results.extra(where=[where], params=[q]) results = results.extra(where=[where], params=[q])
results = results.order_by("-modified_at") results = results.order_by("-modified_at")