mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-03-01 14:51:07 -05:00
Use a (hopefully) more efficient SQL query for doing recency based room search
This commit is contained in:
parent
39de87869c
commit
14a9d805b9
@ -253,11 +253,13 @@ class SearchStore(BackgroundUpdateStore):
|
|||||||
)
|
)
|
||||||
elif isinstance(self.database_engine, Sqlite3Engine):
|
elif isinstance(self.database_engine, Sqlite3Engine):
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT rank(matchinfo(event_search)) as rank, room_id, event_id,"
|
"SELECT rank(matchinfo) as rank, room_id, event_id,"
|
||||||
" topological_ordering, stream_ordering"
|
" topological_ordering, stream_ordering"
|
||||||
" FROM event_search"
|
" FROM (SELECT event_id, matchinfo(event_search) FROM event_search"
|
||||||
" NATURAL JOIN events"
|
" WHERE value MATCH"
|
||||||
" WHERE value MATCH ? AND room_id = ?"
|
" )"
|
||||||
|
" CROSS JOIN events USING (event_id)"
|
||||||
|
" WHERE room_id = ?"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# This should be unreachable.
|
# This should be unreachable.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user