bug 587789, case insensitive guid search
This commit is contained in:
Родитель
26937318d1
Коммит
edbb7df505
|
@ -95,14 +95,14 @@ def extract_filters(term, kwargs):
|
|||
metas['type'] = addon_type
|
||||
|
||||
# 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)
|
||||
|
||||
if guids:
|
||||
guids_crc = []
|
||||
|
||||
for guid in guids.split(','):
|
||||
guids_crc.append(crc32(guid))
|
||||
guids_crc.append(crc32(guid.lower()))
|
||||
|
||||
filters['guid_ord'] = guids_crc
|
||||
|
||||
|
|
|
@ -128,7 +128,11 @@ class SearchTest(SphinxTestCase):
|
|||
"""Filter by guid."""
|
||||
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)
|
||||
|
||||
def test_alpha_sort(self):
|
||||
|
|
|
@ -93,7 +93,7 @@ source addons
|
|||
a.id AS addon_id, \
|
||||
a.addontype_id AS type, \
|
||||
a.status, \
|
||||
CRC32(a.guid) AS guid_ord, \
|
||||
CRC32(LOWER(a.guid)) AS guid_ord, \
|
||||
name.locale, \
|
||||
CRC32(name.locale) AS locale_ord, \
|
||||
a.bayesianrating AS averagerating, \
|
||||
|
|
Загрузка…
Ссылка в новой задаче