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 view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/tdIUkptWpZgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment