It's possible to add new lookup types, providing you use a custom
queryset, because you have to set the Query.query_terms attribute.
Easiest way to see how this is done in practice, is to look at
django.contrib.gis, which adds a bunch of GIS-specific query terms. In
particular, django/contrib/gis/db/models/sql/query.py.
One day we might add a way to add custom lookup types for fields, but
it's not entirely trivial, as there's a fine balance between making
something that's not too difficult to use, whilst being portable and
without leaking SQL all over the Field subclasses.
Regards,
Malcolm
Hi,
Depending on the database engine you're using, it could be way easier
to rely on collations to solve your problem.
Check out this link ( http://bugs.mysql.com/bug.php?id=9604 ) if you're running
MySQL; regarding the 'Ł' and 'L' equality in polish and general unicode
collations. Seems like cp1250_general_* is the only one comparing all polish
characters 'correctly' to their english equivalent. Hope that helps,
--
Clément
I'm not sure this mailing list is the best place to discuss further
that topic, I guess you'll get more feedback on
http://forums.mysql.com/ if you want to keep going in the collation
direction, or on django-users.
Anyway, on that 'ś' problem, you should know more or less the full
list of polish characters and their english counterpart you want to
have equality for. I suggest you do some tests using different
built-in collations (utf8_general_ci, utf8_unicode_ci, utf8_polish_ci,
cp1250_general_ci, cp1250_polish_ci, etc.) to see if one of those
matches exactly your needs.
Well, there might also be none. But in that case, there's a
straightforward solution, just define your own collation. In MySQL 5
you don't need to recompile if you want to add a new collation based
on utf8_unicode_ci. Have a look at those links :
http://forge.mysql.com/w/images/b/b7/HowToAddACollation.pdf
http://dev.mysql.com/doc/refman/5.0/en/adding-collation-unicode-uca.html
http://unicode.org/reports/tr35/
Then you can keep tables text field in a 'regular' polish collation,
but use the custom one for search queries.
--
Clément
2009/5/6 pbzRPA <pbz...@gmail.com>: