encode / django-rest-framework

Web APIs for Django. 🎸
https://www.django-rest-framework.org
Other
28.21k stars 6.81k forks source link

Add `unaccent` to `SearchFilter` #9385

Open mgaligniana opened 5 months ago

mgaligniana commented 5 months ago

Description

Based on discussion https://github.com/encode/django-rest-framework/discussions/7759 I've created this PR to continue the work made in https://github.com/encode/django-rest-framework/pull/8775 and https://github.com/encode/django-rest-framework/pull/7733

There are no tests with PostgreSQL but I'm creating this to test with the CI

mgaligniana commented 5 months ago

Hi @auvipy!

In case I would like to add a postgres db creation step, to be able to add new tests: should I add a step here .github/workflows/main.yml?

mgaligniana commented 4 months ago

I move this PR to Ready for review as the work is done but I need confirmation on how to add (or if it worth it) a step using PostgreSQL to be able to test it.

Thank you!

jensjeflensje commented 1 month ago

Tried this locally and the unaccent works great. It got me thinking though: anyone using unaccent is probably not interested in a full match either? The current code limits icontains from being used too alongside unaccent. I personally set my lookup prefix to "&": "unaccent__icontains" as that better fits my (and probably also other people's) usecases.