ResultSet: fix title filter clause when no filters are passed
This causes kicker favorites to be empty.
SELECT
from_table.targettedResource as resource
, SUM(rsc.cachedScore) as score
, MIN(rsc.firstUpdate) as firstUpdate
, MAX(rsc.lastUpdate) as lastUpdate
, from_table.usedActivity as activity
, from_table.initiatingAgent as agent
, COALESCE(ri.title, from_table.targettedResource) as title
, ri.mimetype as mimetype
, 2 as linkStatus
FROM
ResourceLink from_table
LEFT JOIN
ResourceScoreCache rsc
ON from_table.targettedResource = rsc.targettedResource
AND from_table.usedActivity = rsc.usedActivity
AND from_table.initiatingAgent = rsc.initiatingAgent
LEFT JOIN
ResourceInfo ri
ON from_table.targettedResource = ri.targettedResource
WHERE
(agent = 'org.kde.plasma.favorites.applications' OR agent = 'org.kde.plasma.favorites.documents')
AND (activity = 'ffffffff-ffff-4fff-bfff-ffffffffffff' OR activity = ':global')
AND (1)
AND (1)
AND (1)
AND (title LIKE '%' ESCAPE '\')
GROUP BY resource, title
ORDER BY linkStatus DESC, score DESC, resource ASC
LIMIT 100
This MR causes AND (title LIKE '%' ESCAPE '\')
clause when no title filters are passed to be replaced with AND (1)
.
I thought this shouldn't happen reading https://www.sqlite.org/lang_expr.html about %
operator, but apparently this causes issues when it is the only character.
This was similarly done in urlFilterClause
since 972f0b26
Edited by Méven Car