summaryrefslogtreecommitdiff
path: root/synapse/handlers/search.py
diff options
context:
space:
mode:
authorAndrej Shadura <andrewsh@debian.org>2021-11-23 13:10:12 +0100
committerAndrej Shadura <andrewsh@debian.org>2021-11-23 13:11:07 +0100
commitae85dc4032c8b1a641e4fd82d4d106bc38bb7743 (patch)
treed64c964cbab32cd52b6d2a5572aff7478bc0d8db /synapse/handlers/search.py
parent6b1856342f58a08702a4ba57d950958e4d668972 (diff)
parent2af61fa72cb6d3cca97fc1e8755968a245c09b96 (diff)
Merge branch 'debian/unstable' into debian/bullseye-backports
Diffstat (limited to 'synapse/handlers/search.py')
-rw-r--r--synapse/handlers/search.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/synapse/handlers/search.py b/synapse/handlers/search.py
index a3ffa26b..6e4dff80 100644
--- a/synapse/handlers/search.py
+++ b/synapse/handlers/search.py
@@ -249,7 +249,7 @@ class SearchHandler:
)
events.sort(key=lambda e: -rank_map[e.event_id])
- allowed_events = events[: search_filter.limit()]
+ allowed_events = events[: search_filter.limit]
for e in allowed_events:
rm = room_groups.setdefault(
@@ -271,13 +271,13 @@ class SearchHandler:
# We keep looping and we keep filtering until we reach the limit
# or we run out of things.
# But only go around 5 times since otherwise synapse will be sad.
- while len(room_events) < search_filter.limit() and i < 5:
+ while len(room_events) < search_filter.limit and i < 5:
i += 1
search_result = await self.store.search_rooms(
room_ids,
search_term,
keys,
- search_filter.limit() * 2,
+ search_filter.limit * 2,
pagination_token=pagination_token,
)
@@ -299,9 +299,9 @@ class SearchHandler:
)
room_events.extend(events)
- room_events = room_events[: search_filter.limit()]
+ room_events = room_events[: search_filter.limit]
- if len(results) < search_filter.limit() * 2:
+ if len(results) < search_filter.limit * 2:
pagination_token = None
break
else:
@@ -311,7 +311,7 @@ class SearchHandler:
group = room_groups.setdefault(event.room_id, {"results": []})
group["results"].append(event.event_id)
- if room_events and len(room_events) >= search_filter.limit():
+ 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"]