Make "limit" a noop in queries

It is difficult to implement, but not as important for gertty as
for the web UI, so make it a no-op for now.

Change-Id: Idf547e82b14b02bb5d9f12e1fe0b2ca5ab06849f
This commit is contained in:
James E. Blair 2015-04-11 16:16:11 -04:00
parent 889d7f793c
commit 5796b706bf
3 changed files with 13 additions and 1 deletions

View File

@ -62,7 +62,7 @@ class SearchCompiler(object):
if __name__ == '__main__':
class Dummy(object):
pass
query = 'reviewer:10068'
query = 'status:open limit:50'
lexer = tokenizer.SearchTokenizer()
lexer.input(query)
while True:

View File

@ -76,6 +76,7 @@ def SearchParser():
| has_term
| is_term
| status_term
| limit_term
| op_term'''
p[0] = p[1]
@ -302,6 +303,16 @@ def SearchParser():
else:
p[0] = gertty.db.change_table.c.status == p[2].upper()
def p_limit_term(p):
'''limit_term : OP_LIMIT NUMBER'''
# TODO: Implement this. The sqlalchemy limit call needs to be
# applied to the query operation and so can not be returned as
# part of the production here. The information would need to
# be returned out-of-band. In the mean time, since limits are
# not as important in gertty, make this a no-op for now so
# that it does not produce a syntax error.
p[0] = (True == True)
def p_op_term(p):
'op_term : OP'
raise SyntaxError()

View File

@ -36,6 +36,7 @@ operators = {
'has': 'OP_HAS',
'is': 'OP_IS',
'status': 'OP_STATUS',
'limit': 'OP_LIMIT',
}
reserved = {