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'), Value(q)))
That works fine by itself for unaccented text, but I'm trying to figure out a way to apply Unaccent to the name variable there, something like:
queryset.annotate(search_index=StrIndex(Lower('name__unaccent'), Value(q)))
--> This has no effect, does the same as the above.
or
queryset.annotate(search_index=StrIndex(Lower(Unaccent('name')), Value(q)))
--> There doesn't seem to be an Unaccent function
Is there a way to do this currently?
Thanks,
Alex