From ea0b3eee053a41c489bcf72f43a72e5ca87b6278 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Wed, 7 Jun 2017 07:33:36 -0400 Subject: [PATCH] Use full, not partial index for history. historyContains includes redirect urls, so we actually don't want a partial index here. --- qutebrowser/browser/history.py | 2 +- qutebrowser/misc/sql.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/qutebrowser/browser/history.py b/qutebrowser/browser/history.py index 008773e62..c64674fdf 100644 --- a/qutebrowser/browser/history.py +++ b/qutebrowser/browser/history.py @@ -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 ' diff --git a/qutebrowser/misc/sql.py b/qutebrowser/misc/sql.py index b63979c0c..0435d2ea3 100644 --- a/qutebrowser/misc/sql.py +++ b/qutebrowser/misc/sql.py @@ -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):