server/search: fix searching for ---

Allow only one negation sign.
Also throw an error if user searches only for "-".
This commit is contained in:
rr- 2017-04-24 19:55:02 +02:00
parent 0014721053
commit 9814b132c3

View file

@ -77,9 +77,11 @@ class Parser:
if not chunk:
continue
negated = False
while chunk[0] == '-':
if chunk[0] == '-':
chunk = chunk[1:]
negated = not negated
negated = True
if not chunk:
raise errors.SearchError('Empty negated token.')
match = re.match('([a-z_-]+):(.*)', chunk)
if match:
key, value = list(match.groups())