From 996b8bedac84553677329c6d9ef3629546b53701 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 26 Sep 2022 07:58:52 +0200 Subject: [PATCH] fixed fuzzy search postgres --- cookbook/views/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/views/api.py b/cookbook/views/api.py index b5a6f267c..be649c2b9 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -170,7 +170,7 @@ class FuzzyFilterMixin(ViewSetMixin, ExtendedRecipeMixin): 'field', flat=True)]) if query is not None and query not in ["''", '']: - if fuzzy: + if fuzzy and (settings.DATABASES['default']['ENGINE'] in ['django.db.backends.postgresql_psycopg2', 'django.db.backends.postgresql']): if any([self.model.__name__.lower() in x for x in self.request.user.searchpreference.unaccent.values_list('field', flat=True)]): self.queryset = self.queryset.annotate(trigram=TrigramSimilarity('name__unaccent', query))