server/search: rename search criterion

This commit is contained in:
rr- 2016-04-17 18:15:59 +02:00
parent c957befbd0
commit 08271caf32
3 changed files with 5 additions and 5 deletions

View file

@ -31,7 +31,7 @@ class BaseSearchConfig(object):
'''
Decorate SQLAlchemy filter on given column using supplied criterion.
'''
if isinstance(criterion, criteria.StringSearchCriterion):
if isinstance(criterion, criteria.PlainSearchCriterion):
expr = column == int(criterion.value)
elif isinstance(criterion, criteria.ArraySearchCriterion):
expr = column.in_(int(value) for value in criterion.values)
@ -55,7 +55,7 @@ class BaseSearchConfig(object):
Decorate SQLAlchemy filter on given column using supplied criterion.
Parse potential wildcards inside the criterion.
'''
if isinstance(criterion, criteria.StringSearchCriterion):
if isinstance(criterion, criteria.PlainSearchCriterion):
expr = column.like(criterion.value.replace('*', '%'))
elif isinstance(criterion, criteria.ArraySearchCriterion):
expr = sqlalchemy.sql.false()
@ -81,7 +81,7 @@ class BaseSearchConfig(object):
Decorate SQLAlchemy filter on given column using supplied criterion.
Parse the datetime inside the criterion.
'''
if isinstance(criterion, criteria.StringSearchCriterion):
if isinstance(criterion, criteria.PlainSearchCriterion):
min_date, max_date = misc.parse_time_range(criterion.value)
expr = column.between(min_date, max_date)
elif isinstance(criterion, criteria.ArraySearchCriterion):

View file

@ -12,7 +12,7 @@ class RangedSearchCriterion(_BaseSearchCriterion):
self.min_value = min_value
self.max_value = max_value
class StringSearchCriterion(_BaseSearchCriterion):
class PlainSearchCriterion(_BaseSearchCriterion):
def __init__(self, original_text, negated, value):
super().__init__(original_text, negated)
self.value = value

View file

@ -126,4 +126,4 @@ class SearchExecutor(object):
if ',' in value:
return criteria.ArraySearchCriterion(
value, negated, value.split(','))
return criteria.StringSearchCriterion(value, negated, value)
return criteria.PlainSearchCriterion(value, negated, value)