Allow negative comparison on null topics
Topics can be null, which means they can't be compared to strings. So a query with "topic:foo" would match changes with topic foo, and not match changes with topic bar or the null topic. However, the inverse, "not topic:foo" does not work as expected. It would match changes with topic bar, but *not* changes with the null topic because that comparison evaluates to unknown. By changing the predicate to "topic is not null and topic = foo" we achive the same results on the positive query, and the negation of that query works as well (since if the topic is null, the expression will evaluate to false in the first half, and if the topic is bar, evaluate to false in the second half). Change-Id: I5a81d5eaae1ef43cea6b897d44a631cac00bf081
This commit is contained in:
parent
c466fa6633
commit
2d2fb1509c
@ -199,7 +199,8 @@ def SearchParser():
|
||||
if p[2].startswith('^'):
|
||||
p[0] = func.matches(p[2], gertty.db.change_table.c.topic)
|
||||
else:
|
||||
p[0] = gertty.db.change_table.c.topic == p[2]
|
||||
p[0] = and_(gertty.db.change_table.c.topic.isnot(None),
|
||||
gertty.db.change_table.c.topic == p[2])
|
||||
|
||||
def p_ref_term(p):
|
||||
'''ref_term : OP_REF string'''
|
||||
|
Loading…
x
Reference in New Issue
Block a user