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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0c069ce3-a79f-48ab-860f-147ed2fc5ddf%40googlegroups.com.

Reply via email to