I was able to figure this out using...
from django.contrib.postgres.lookups import Unaccent
queryset.annotate(search_index=StrIndex(Unaccent(Lower('name')), Value(q)))
Might be nice to add to the documentation here:
https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/lookups/#unaccent
O
Hi all,
I just started using the Unaccent extension for Postgres and implementing
queryset filters with it like:
q = 'hello'
queryset.filter(name__unaccent__istartswith=q)
I'm now trying to annotate the queryset result with the search index:
queryset.annotate(search_index=StrIndex(Lower('name'
2 matches
Mail list logo