Bug 1287277 - Avoid querying bookmark title and tags for non-bookmarked items. r=mak

--HG--
extra : rebase_source : 54104dcad3432d46adbe7c54a8afb914abb23fff
This commit is contained in:
Simon Lindholm 2016-07-14 16:13:04 +02:00
Родитель 250514830e
Коммит 5c68ffe2b9
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -109,6 +109,8 @@ const SQL_BOOKMARK_TAGS_FRAGMENT =
// TODO bug 412736: in case of a frecency tie, we might break it with h.typed
// and h.visit_count. That is slower though, so not doing it yet...
// NB: as a slight performance optimization, we only evaluate the "btitle"
// and "tags" queries for bookmarked entries.
function defaultQuery(conditions = "") {
let query =
`SELECT :query_type, h.url, h.title, f.url, ${SQL_BOOKMARK_TAGS_FRAGMENT},
@ -118,7 +120,12 @@ function defaultQuery(conditions = "") {
LEFT JOIN moz_openpages_temp t ON t.url = h.url
WHERE h.frecency <> 0
AND AUTOCOMPLETE_MATCH(:searchString, h.url,
IFNULL(btitle, h.title), tags,
CASE WHEN bookmarked THEN
IFNULL(btitle, h.title)
ELSE h.title END,
CASE WHEN bookmarked THEN
tags
ELSE '' END,
h.visit_count, h.typed,
bookmarked, t.open_count,
:matchBehavior, :searchBehavior)