Tidy up a bit

pull/403/head
Erik Johnston 2015-12-01 11:06:40 +00:00
parent 4dcaa42b6d
commit da7dd58641
1 changed files with 9 additions and 8 deletions

View File

@ -226,19 +226,20 @@ class SearchHandler(BaseHandler):
if len(results) < search_filter.limit() * 2: if len(results) < search_filter.limit() * 2:
pagination_token = None pagination_token = None
break
else: else:
pagination_token = results[-1]["pagination_token"] pagination_token = results[-1]["pagination_token"]
if room_events: for event in room_events:
for event in room_events: group = room_groups.setdefault(event.room_id, {
group = room_groups.setdefault(event.room_id, { "results": [],
"results": [], })
}) group["results"].append(event.event_id)
group["results"].append(event.event_id)
pagination_token = results_map[room_events[-1].event_id]["pagination_token"] if room_events and len(room_events) >= search_filter.limit():
last_event_id = room_events[-1].event_id
pagination_token = results_map[last_event_id]["pagination_token"]
if pagination_token:
global_next_batch = encode_base64("%s\n%s\n%s" % ( global_next_batch = encode_base64("%s\n%s\n%s" % (
"all", "", pagination_token "all", "", pagination_token
)) ))