case insensitive search

551 views
Skip to first unread message

DULMANDAKH Sukhbaatar

unread,
Oct 28, 2008, 8:27:01 AM10/28/08
to django...@googlegroups.com
Hello all.

Just now I've deployed my first django web app. it's kind of address
book. everything went smoothly.
http://docs.djangoproject.com/en/dev/ref/contrib/admin/ says that
search_fields is case insensitive. but when I search some person using
django admin, it shows exact matches with case. I need to search
everything no mater what the case is.

I'm using django 1.0, and sqlite3 as a storage.

--
Regards
Dulmandakh

srini

unread,
Oct 28, 2008, 9:19:58 AM10/28/08
to Django users
Mr.Dulmandakh

Use search_fields = ['name'] in the corresponding
class inside admin.py

Their is no such a case sensitive exists in Django search field ,
It will show
it's matches either case sensitive or case insensitive.



> Hello all.
>
> Just now I've deployed my first django web app. it's kind of address
> book. everything went smoothly.http://docs.djangoproject.com/en/dev/ref/contrib/admin/says that

DULMANDAKH Sukhbaatar

unread,
Oct 28, 2008, 10:54:19 AM10/28/08
to django...@googlegroups.com
> Use search_fields = ['name'] in the corresponding
> class inside admin.py

I did. Actually my text is Cyrillic. Just now I tested searching
sample latin or english text, and search workin fine. Is it problem
with non-english text? if so how i can fix it, and make work?


--
Regards
Dulmandakh

Karen Tracey

unread,
Oct 28, 2008, 11:28:48 AM10/28/08
to django...@googlegroups.com

Django's case-insensitive  search is going to map to a LIKE query for sqlite.  According to this page:

http://www.sqlite.org/lang_expr.html

sqlite doesn't handle case-insensitive searches for anything except 7-bit ASCII:

"(A bug: SQLite only understands upper/lower case for 7-bit Latin characters. Hence the LIKE operator is case sensitive for 8-bit iso8859 characters or UTF-8 characters. For example, the expression 'a' LIKE 'A' is TRUE but 'æ' LIKE 'Æ' is FALSE.)."

So it sounds like you will need to move to a different DB if you want case-insensitive searching to work for Cyrillic chars.

Karen

DULMANDAKH Sukhbaatar

unread,
Oct 28, 2008, 9:13:39 PM10/28/08
to django...@googlegroups.com
> "(A bug: SQLite only understands upper/lower case for 7-bit Latin
> characters. Hence the LIKE operator is case sensitive for 8-bit iso8859
> characters or UTF-8 characters. For example, the expression 'a' LIKE 'A' is
> TRUE but 'æ' LIKE 'Æ' is FALSE.)."

Got it.

> So it sounds like you will need to move to a different DB if you want
> case-insensitive searching to work for Cyrillic chars.

also sqlite3 seemed very slow compared to MySQL. then I'll switch to
mysql. thank you.


--
Regards
Dulmandakh

Reply all
Reply to author
Forward
0 new messages