Also use plainto_tsquery when using unaccent

This commit is contained in:
Yohan Boniface 2016-03-10 22:47:28 +01:00
parent 9af9d95628
commit c4287bf39e

View file

@ -147,7 +147,7 @@ class Search(TemplateView, PaginatorMixin):
if q: if q:
where = "to_tsvector(name) @@ plainto_tsquery(%s)" where = "to_tsvector(name) @@ plainto_tsquery(%s)"
if getattr(settings, 'UMAP_USE_UNACCENT', False): if getattr(settings, 'UMAP_USE_UNACCENT', False):
where = "to_tsvector(unaccent(name)) @@ to_tsquery(unaccent(%s))" # noqa where = "to_tsvector(unaccent(name)) @@ plainto_tsquery(unaccent(%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')