Hi Karen, Here's an example of one of the models in question:
class WorkCategory(models.Model): title = models.CharField(max_length = 30) position = models.PositiveSmallIntegerField() def __unicode__(self): return self.title class Admin: ordering = ('position',) search_fields = ('title') class Meta: verbose_name_plural = 'Work Categories' When I created the database, I specified the default character set as unicode, but other than that, I haven't made any changes to the database. I actually haven't even touched it directly, only through the Python code in Django. Thoughts? Brandon On Apr 9, 2:20 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Wed, Apr 9, 2008 at 2:16 PM, Brandon Taylor <[EMAIL PROTECTED]> > wrote: > > > > > I'm using MySQL 5, and it's using LIKE instead of ILIKE. I'll try > > grabbing the latest from trunk and see how she goes, otherwise I might > > switch to Postgres and file a ticket if the latest trunk doesn't > > address this. > > MySQL doesn't have ILIKE, by default its LIKE searches are case > insensitive. See: > > http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html > > If you are getting case-sensitive search results from MySQL that would seem > to imply you've got a case-sensitive collation specified for that column (or > possibly a case-sensitive default collation)? > > Karen > > > > > Thank you SO much for your help! > > Brandon > > > On Apr 9, 1:10 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > > > Hi Brandon, > > > > > I see what the problem is, which isn't related to the SQL at all. It > > > > appears that "icontains" is not behaving as expected. It's supposed to > > > > be case-insensitive, but it's doing the opposite. > > > > > Example, if I search for a WorkCategory using "print" it will return 0 > > > > results. If I use "Print" it will return all of the WorkSamples with > > > > the category of "Print" > > > > > Thoughts? > > > > In the generated SQL, do you see LIKE instead of ILIKE in the WHERE > > > clause for the category match? Realize that contains and icontains > > > merely translate to the SQL test LIKE and ILIKE respectively which > > > your database is supposed to understand. So, it's either a Django bug > > > or a DB problem. You will know that by looking at the SQL being > > > generated (it should show ILIKE in the WHERE clause.) For example, > > > SQLite doesn't support case-sensitive contains (to it contains is the > > > same as icontains.) Your problem seems to be the opposite, though. > > > > Try some of these things: > > > > Run a straight query on the Category table with with > > > title__icontains='print' first. > > > > If that works but the main query doesn't, try updating your Django to > > > the latest trunk. > > > > If that still doesn't work, consider filing a ticket. > > > > -Rajesh --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---