Explicitly check for Sqlite3Engine

This commit is contained in:
Erik Johnston 2015-10-16 14:37:14 +01:00
parent b62da463e1
commit edb998ba23

View File

@ -16,7 +16,7 @@
from twisted.internet import defer from twisted.internet import defer
from _base import SQLBaseStore from _base import SQLBaseStore
from synapse.storage.engines import PostgresEngine from synapse.storage.engines import PostgresEngine, Sqlite3Engine
class SearchStore(SQLBaseStore): class SearchStore(SQLBaseStore):
@ -56,11 +56,14 @@ class SearchStore(SQLBaseStore):
" FROM plainto_tsquery('english', ?) as query, event_search" " FROM plainto_tsquery('english', ?) as query, event_search"
" WHERE vector @@ query" " WHERE vector @@ query"
) )
else: elif isinstance(self.database_engine, Sqlite3Engine):
sql = ( sql = (
"SELECT 0 as rank, event_id FROM event_search" "SELECT 0 as rank, event_id FROM event_search"
" WHERE value MATCH ?" " WHERE value MATCH ?"
) )
else:
# This should be unreachable.
raise Exception("Unrecognized database engine")
for clause in clauses: for clause in clauses:
sql += " AND " + clause sql += " AND " + clause