Skip to content
Snippets Groups Projects
Commit 9670f226 authored by Erik Johnston's avatar Erik Johnston
Browse files

Merge pull request #406 from matrix-org/erikj/search

Search: Don't disregard grouping info in pagination tokens
parents 65a9bf2d 27c5e1b3
No related branches found
No related tags found
No related merge requests found
......@@ -240,9 +240,18 @@ class SearchHandler(BaseHandler):
last_event_id = room_events[-1].event_id
pagination_token = results_map[last_event_id]["pagination_token"]
global_next_batch = encode_base64("%s\n%s\n%s" % (
"all", "", pagination_token
))
# We want to respect the given batch group and group keys so
# that if people blindly use the top level `next_batch` token
# it returns more from the same group (if applicable) rather
# than reverting to searching all results again.
if batch_group and batch_group_key:
global_next_batch = encode_base64("%s\n%s\n%s" % (
batch_group, batch_group_key, pagination_token
))
else:
global_next_batch = encode_base64("%s\n%s\n%s" % (
"all", "", pagination_token
))
for room_id, group in room_groups.items():
group["next_batch"] = encode_base64("%s\n%s\n%s" % (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment