bug 587789, case insensitive guid search

This commit is contained in:
Dave Dash 2010-08-18 12:27:27 -07:00
Родитель 26937318d1
Коммит edbb7df505
3 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -95,14 +95,14 @@ def extract_filters(term, kwargs):
metas['type'] = addon_type metas['type'] = addon_type
# Guid filtering.. # Guid filtering..
(term, guids) = extract_from_query(term, 'guid', '[{}@\.,\-0-9a-z]+', (term, guids) = extract_from_query(term, 'guid', '[{}@\.,\-0-9a-zA-Z]+',
end_of_word_boundary=False) end_of_word_boundary=False)
if guids: if guids:
guids_crc = [] guids_crc = []
for guid in guids.split(','): for guid in guids.split(','):
guids_crc.append(crc32(guid)) guids_crc.append(crc32(guid.lower()))
filters['guid_ord'] = guids_crc filters['guid_ord'] = guids_crc

Просмотреть файл

@ -128,7 +128,11 @@ class SearchTest(SphinxTestCase):
"""Filter by guid.""" """Filter by guid."""
eq_(query('guid:{4c197c8f-a50f-4b49-a2d2-ed922c95612f}')[0].id, 592) eq_(query('guid:{4c197c8f-a50f-4b49-a2d2-ed922c95612f}')[0].id, 592)
def test_guid_email_filter(self): def test_guid_filter_uppercase(self):
"""Filter by guids in whatever case I like."""
eq_(query('guid:{4C197C8F-A50F-4B49-A2D2-ED922C95612F}')[0].id, 592)
def test_guid_filter_email(self):
eq_(query('guid:yslow@yahoo-inc.com')[0].id, 5369) eq_(query('guid:yslow@yahoo-inc.com')[0].id, 5369)
def test_alpha_sort(self): def test_alpha_sort(self):

Просмотреть файл

@ -93,7 +93,7 @@ source addons
a.id AS addon_id, \ a.id AS addon_id, \
a.addontype_id AS type, \ a.addontype_id AS type, \
a.status, \ a.status, \
CRC32(a.guid) AS guid_ord, \ CRC32(LOWER(a.guid)) AS guid_ord, \
name.locale, \ name.locale, \
CRC32(name.locale) AS locale_ord, \ CRC32(name.locale) AS locale_ord, \
a.bayesianrating AS averagerating, \ a.bayesianrating AS averagerating, \