From a01c76db54a8a997a1d46d411aa840e5a6ed7436 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Fri, 2 Jun 2017 07:47:28 -0400 Subject: [PATCH] Remove 'group by' from url completion query. This seemed to have a significant performance impact. Removing it means that instead of just seeing the most recent atime for a given url, you will see multiple entries. --- qutebrowser/completion/models/urlmodel.py | 4 ++-- tests/unit/completion/test_models.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qutebrowser/completion/models/urlmodel.py b/qutebrowser/completion/models/urlmodel.py index 9e2571848..b106da366 100644 --- a/qutebrowser/completion/models/urlmodel.py +++ b/qutebrowser/completion/models/urlmodel.py @@ -75,9 +75,9 @@ def url(): columns_to_filter=[0, 1])) timefmt = config.get('completion', 'timestamp-format') - select_time = "strftime('{}', max(atime), 'unixepoch')".format(timefmt) + select_time = "strftime('{}', atime, 'unixepoch')".format(timefmt) hist_cat = sqlcategory.SqlCategory( - 'History', sort_order='desc', sort_by='atime', group_by='url', + 'History', sort_order='desc', sort_by='atime', filter_fields=['url', 'title'], select='url, title, {}'.format(select_time), where='not redirect') model.add_category(hist_cat) diff --git a/tests/unit/completion/test_models.py b/tests/unit/completion/test_models.py index c46287926..46730cc21 100644 --- a/tests/unit/completion/test_models.py +++ b/tests/unit/completion/test_models.py @@ -306,7 +306,9 @@ def test_url_completion(qtmodeltester, config_stub, web_history, quickmarks, "History": [ ('https://github.com', 'https://github.com', '2016-05-01'), ('https://python.org', 'Welcome to Python.org', '2016-03-08'), + ('https://python.org', 'Welcome to Python.org', '2016-02-08'), ('http://qutebrowser.org', 'qutebrowser', '2015-09-05'), + ('https://python.org', 'Welcome to Python.org', '2014-03-08'), ], })