Fix negation queries
This commit is contained in:
parent
b7c9165bbd
commit
3ba45b7c87
2 changed files with 4 additions and 4 deletions
|
@ -174,7 +174,7 @@ class FindQuery:
|
|||
elif op is Operators.NE:
|
||||
# TODO: Is this enough or do we also need a clause for all values
|
||||
# ([-inf +inf]) from which we then subtract the undesirable value?
|
||||
result += f"~(@{field_name}:[{value} {value}])"
|
||||
result += f"-(@{field_name}:[{value} {value}])"
|
||||
elif op is Operators.GT:
|
||||
result += f"@{field_name}:[({value} +inf]"
|
||||
elif op is Operators.LT:
|
||||
|
@ -187,13 +187,13 @@ class FindQuery:
|
|||
if op is Operators.EQ:
|
||||
result += f"@{field_name}:{{{value}}}"
|
||||
elif op is Operators.NE:
|
||||
result += f"~(@{field_name}:{{{value}}})"
|
||||
result += f"-(@{field_name}:{{{value}}})"
|
||||
elif op is Operators.IN:
|
||||
expanded_value = self.expand_tag_value(value)
|
||||
result += f"(@{field_name}:{{{expanded_value}}})"
|
||||
elif op is Operators.NOT_IN:
|
||||
expanded_value = self.expand_tag_value(value)
|
||||
result += f"~(@{field_name}:{{{expanded_value}}})"
|
||||
result += f"-(@{field_name}:{{{expanded_value}}})"
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ def test_schema():
|
|||
another_float: float
|
||||
|
||||
# TODO: Fix
|
||||
assert Address.schema() == "ON HASH PREFIX 1 redis-developer:address: " \
|
||||
assert Address.schema() == "ON HASH PREFIX 1 redis-developer:tests.test_hash_model.Address: " \
|
||||
"SCHEMA pk TAG a_string TAG a_full_text_string TAG " \
|
||||
"a_full_text_string_fts TEXT an_integer NUMERIC SORTABLE " \
|
||||
"a_float NUMERIC"
|
||||
|
|
Loading…
Reference in a new issue