diff options
author | Erik Johnston <erik@matrix.org> | 2015-10-09 15:48:31 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-10-09 15:48:31 +0100 |
commit | c85c9125627a62c73711786723be12be30d7a81e (patch) | |
tree | e5d32fb9a3f90a764ce3bbe89b5f8e0f619205bc /synapse/rest | |
parent | Merge pull request #292 from matrix-org/daniel/useragent (diff) | |
download | synapse-c85c9125627a62c73711786723be12be30d7a81e.tar.xz |
Add basic full text search impl.
Diffstat (limited to 'synapse/rest')
-rw-r--r-- | synapse/rest/client/v1/room.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py index 23871f161e..35bd702a43 100644 --- a/synapse/rest/client/v1/room.py +++ b/synapse/rest/client/v1/room.py @@ -529,6 +529,22 @@ class RoomTypingRestServlet(ClientV1RestServlet): defer.returnValue((200, {})) +class SearchRestServlet(ClientV1RestServlet): + PATTERN = client_path_pattern( + "/search$" + ) + + @defer.inlineCallbacks + def on_POST(self, request): + auth_user, _ = yield self.auth.get_user_by_req(request) + + content = _parse_json(request) + + results = yield self.handlers.search_handler.search(content) + + defer.returnValue((200, results)) + + def _parse_json(request): try: content = json.loads(request.content.read()) @@ -585,3 +601,4 @@ def register_servlets(hs, http_server): RoomInitialSyncRestServlet(hs).register(http_server) RoomRedactEventRestServlet(hs).register(http_server) RoomTypingRestServlet(hs).register(http_server) + SearchRestServlet(hs).register(http_server) |