Use full, not partial index for history.

historyContains includes redirect urls, so we actually don't want a
partial index here.
This commit is contained in:
Ryan Roden-Corrent 2017-06-07 07:33:36 -04:00
parent 478a719f77
commit ea0b3eee05
2 changed files with 4 additions and 5 deletions

View File

@ -78,7 +78,7 @@ class WebHistory(sql.SqlTable):
def __init__(self, parent=None):
super().__init__("History", ['url', 'title', 'atime', 'redirect'],
parent=parent)
self.create_index('HistoryIndex', 'url', where='not redirect')
self.create_index('HistoryIndex', 'url')
self._contains_query = self.contains_query('url')
self._between_query = sql.Query('SELECT * FROM History '
'where not redirect '

View File

@ -123,16 +123,15 @@ class SqlTable(QObject):
# pylint: disable=invalid-name
self.Entry = collections.namedtuple(name + '_Entry', fields)
def create_index(self, name, field, where):
def create_index(self, name, field):
"""Create an index over this table.
Args:
name: Name of the index, should be unique.
field: Name of the field to index.
where: WHERE clause for a partial index.
"""
q = Query("CREATE INDEX IF NOT EXISTS {} ON {} ({}) WHERE {}"
.format(name, self._name, field, where))
q = Query("CREATE INDEX IF NOT EXISTS {} ON {} ({})"
.format(name, self._name, field))
q.run()
def __iter__(self):