server/search: fix searching for ---
Allow only one negation sign. Also throw an error if user searches only for "-".
This commit is contained in:
parent
0014721053
commit
9814b132c3
|
@ -77,9 +77,11 @@ class Parser:
|
||||||
if not chunk:
|
if not chunk:
|
||||||
continue
|
continue
|
||||||
negated = False
|
negated = False
|
||||||
while chunk[0] == '-':
|
if chunk[0] == '-':
|
||||||
chunk = chunk[1:]
|
chunk = chunk[1:]
|
||||||
negated = not negated
|
negated = True
|
||||||
|
if not chunk:
|
||||||
|
raise errors.SearchError('Empty negated token.')
|
||||||
match = re.match('([a-z_-]+):(.*)', chunk)
|
match = re.match('([a-z_-]+):(.*)', chunk)
|
||||||
if match:
|
if match:
|
||||||
key, value = list(match.groups())
|
key, value = list(match.groups())
|
||||||
|
|
Loading…
Reference in New Issue