diff --git a/synapse/storage/search.py b/synapse/storage/search.py
index eac265b543dff3964e69f4331c4b3b377d32ed9a..e1911e248086f331c072dac18095a52ec791d408 100644
--- a/synapse/storage/search.py
+++ b/synapse/storage/search.py
@@ -255,8 +255,9 @@ class SearchStore(BackgroundUpdateStore):
             sql = (
                 "SELECT rank(matchinfo) as rank, room_id, event_id,"
                 " topological_ordering, stream_ordering"
-                " FROM (SELECT event_id, matchinfo(event_search) FROM event_search"
-                " WHERE value MATCH"
+                " FROM (SELECT key, event_id, matchinfo(event_search) as matchinfo"
+                " FROM event_search"
+                " WHERE value MATCH ?"
                 " )"
                 " CROSS JOIN events USING (event_id)"
                 " WHERE room_id = ?"