diff --git a/server/szurubooru/search/base_search_config.py b/server/szurubooru/search/base_search_config.py index df29b4f8..88492020 100644 --- a/server/szurubooru/search/base_search_config.py +++ b/server/szurubooru/search/base_search_config.py @@ -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): diff --git a/server/szurubooru/search/criteria.py b/server/szurubooru/search/criteria.py index b7d47d84..422966b4 100644 --- a/server/szurubooru/search/criteria.py +++ b/server/szurubooru/search/criteria.py @@ -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 diff --git a/server/szurubooru/search/search_executor.py b/server/szurubooru/search/search_executor.py index 59ccaf22..13eebc94 100644 --- a/server/szurubooru/search/search_executor.py +++ b/server/szurubooru/search/search_executor.py @@ -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)