Hi, if you are using postgreSQL, I released a week ago a library to do
just what you need: see: https://github.com/djcoin/django-unaccent/

Once you got the `unaccent` function set up in your postgreSQL db, you
can make unaccented search from the Django ORM as usual.
Eg: Given a book title of "The book of Café",
`Book.objects.filter(title__icontains_unaccent='Cafe')` will match

Cheers,
Simon

On Jun 1, 7:03 pm, Joni Bekenstein <jonibekenst...@gmail.com> wrote:
> I need to do a simple search ignoring some characters with accents. The
> idea would be that "hola" matches the search term "holá".
>
> What I'm currently doing is adding a CharField to my model to store the
> searchable term. For example:
>
> class Book(models.Model):
>   title = models.CharField(max_length=100)
>   searchable_title = models.CharField(max_length=100)
>
> When I save a Book I'll replace the accented characters in title with their
> non-accented counterparts and store the result in searchable_title. The,
> I'll also do the same thing with the search term before actually doing the
> query.
>
> I don't like this approach because if I need to add more searchable fields
> things start getting noisy in my models.
>
> Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to