server/search: match only [a-z-]* for named tokens

Adds ability to search for *:* for example. Still not perfect, but it's
a start.
This commit is contained in:
rr- 2016-09-26 22:06:18 +02:00
parent 0e31e1fd14
commit 1bd8af47b0

View file

@ -92,8 +92,9 @@ class Parser(object):
while chunk[0] == '-': while chunk[0] == '-':
chunk = chunk[1:] chunk = chunk[1:]
negated = not negated negated = not negated
if ':' in chunk and chunk[0] != ':': match = re.match('([a-z_-]+):(.*)', chunk)
key, value = chunk.split(':', 2) if match:
key, value = list(match.groups())
if key == 'sort': if key == 'sort':
query.sort_tokens.append( query.sort_tokens.append(
_parse_sort(value, negated)) _parse_sort(value, negated))