summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-10-29 16:17:47 +0000
committerErik Johnston <erik@matrix.org>2015-10-29 16:17:47 +0000
commitf6e6f3d87a30932f706e39f4fb2d9f07d3270dce (patch)
tree487fc4ab22d4ef46950694556364af7698257ed5 /synapse
parentMerge pull request #336 from matrix-org/erikj/search (diff)
downloadsynapse-f6e6f3d87a30932f706e39f4fb2d9f07d3270dce.tar.xz
Make search API honour limit set in filter
Diffstat (limited to '')
-rw-r--r--synapse/handlers/search.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/handlers/search.py b/synapse/handlers/search.py
index b13fb71d81..2718e9482e 100644
--- a/synapse/handlers/search.py
+++ b/synapse/handlers/search.py
@@ -87,6 +87,9 @@ class SearchHandler(BaseHandler):
             user.to_string(), filtered_events
         )
 
+        allowed_events.sort(key=lambda e: -rank_map[e.event_id])
+        allowed_events = allowed_events[:search_filter.limit()]
+
         if event_context is not None:
             now_token = yield self.hs.get_event_sources().get_current_token()