server/search: make searches case insensitive
This commit is contained in:
parent
82d32ba1fb
commit
6179f016ae
|
@ -62,11 +62,11 @@ class BaseSearchConfig(object):
|
|||
Decorate SQLAlchemy filter on given column using supplied criterion.
|
||||
'''
|
||||
if isinstance(criterion, criteria.PlainSearchCriterion):
|
||||
expr = column.like(transformer(criterion.value))
|
||||
expr = column.ilike(transformer(criterion.value))
|
||||
elif isinstance(criterion, criteria.ArraySearchCriterion):
|
||||
expr = sqlalchemy.sql.false()
|
||||
for value in criterion.values:
|
||||
expr = expr | column.like(transformer(value))
|
||||
expr = expr | column.ilike(transformer(value))
|
||||
elif isinstance(criterion, criteria.RangedSearchCriterion):
|
||||
raise szurubooru.errors.SearchError(
|
||||
'Composite token %r is invalid in this context.' % (criterion,))
|
||||
|
|
|
@ -22,6 +22,7 @@ def verify_unpaged(executor):
|
|||
('t1', ['t1']),
|
||||
('t2', ['t2']),
|
||||
('t1,t2', ['t1', 't2']),
|
||||
('T1,T2', ['t1', 't2']),
|
||||
])
|
||||
def test_filter_anonymous(verify_unpaged, tag_factory, input, expected_tag_names):
|
||||
db.session.add(tag_factory(names=['t1']))
|
||||
|
|
Loading…
Reference in New Issue