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
1 changed files with 4 additions and 2 deletions
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue