server: make negated string filters include null values
This commit is contained in:
parent
190d795426
commit
1174cf4861
1 changed files with 2 additions and 2 deletions
|
@ -124,11 +124,11 @@ def apply_str_criterion_to_column(
|
||||||
transformer: Callable[[str], str] = wildcard_transformer,
|
transformer: Callable[[str], str] = wildcard_transformer,
|
||||||
) -> SaQuery:
|
) -> SaQuery:
|
||||||
if isinstance(criterion, criteria.PlainCriterion):
|
if isinstance(criterion, criteria.PlainCriterion):
|
||||||
expr = column.ilike(transformer(criterion.value))
|
expr = sa.and_(column != None, column.ilike(transformer(criterion.value)))
|
||||||
elif isinstance(criterion, criteria.ArrayCriterion):
|
elif isinstance(criterion, criteria.ArrayCriterion):
|
||||||
expr = sa.sql.false()
|
expr = sa.sql.false()
|
||||||
for value in criterion.values:
|
for value in criterion.values:
|
||||||
expr = expr | column.ilike(transformer(value))
|
expr = expr | sa.and_(column != None, column.ilike(transformer(value)))
|
||||||
elif isinstance(criterion, criteria.RangedCriterion):
|
elif isinstance(criterion, criteria.RangedCriterion):
|
||||||
raise errors.SearchError(
|
raise errors.SearchError(
|
||||||
"Ranged criterion is invalid in this context. "
|
"Ranged criterion is invalid in this context. "
|
||||||
|
|
Loading…
Reference in a new issue