51 lines
2.0 KiB
Diff
51 lines
2.0 KiB
Diff
From 1fc19e8dfb8290ad7d21ba8f8913160f880a095b Mon Sep 17 00:00:00 2001
|
|
From: Vishesh Handa <me@vhanda.in>
|
|
Date: Tue, 21 Oct 2014 17:59:40 +0200
|
|
Subject: [PATCH 2/2] Baloo Runner: Lower relevance because krunner does not
|
|
know any better
|
|
|
|
The KRunner framework expects all runners to set a relevance for each
|
|
match, except that this relevance information is taken to globally sort
|
|
the results. So I can write a plugin which whose results will always be
|
|
on top. Yaye! </sarcasm>
|
|
|
|
Explicitly lower Baloo's relevance so that in general applications are
|
|
higher.
|
|
---
|
|
runners/baloo/baloosearchrunner.cpp | 12 +++++++++---
|
|
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/runners/baloo/baloosearchrunner.cpp b/runners/baloo/baloosearchrunner.cpp
|
|
index 996f719..115abd0 100644
|
|
--- a/runners/baloo/baloosearchrunner.cpp
|
|
+++ b/runners/baloo/baloosearchrunner.cpp
|
|
@@ -99,7 +99,13 @@ void SearchRunner::match(Plasma::RunnerC
|
|
|
|
Baloo::ResultIterator it = query.exec();
|
|
|
|
- int relevance = 100;
|
|
+ // KRunner is absolutely retarded and allows plugins to set the global
|
|
+ // relevance levels. so Baloo should not set the relevance of results too
|
|
+ // high because then Applications will often appear after if the application
|
|
+ // runner has not a higher relevance. So stupid.
|
|
+ // Each runner plugin should not have to know about the others.
|
|
+ // Anyway, that's why we're starting with .75
|
|
+ float relevance = .75;
|
|
while (context.isValid() && it.next()) {
|
|
Plasma::QueryMatch match(this);
|
|
match.setIcon(QIcon::fromTheme(it.icon()));
|
|
@@ -108,8 +114,8 @@ void SearchRunner::match(Plasma::RunnerC
|
|
match.setData(it.url());
|
|
match.setType(Plasma::QueryMatch::PossibleMatch);
|
|
match.setMatchCategory(category);
|
|
- match.setRelevance(relevance * .01);
|
|
- relevance--;
|
|
+ match.setRelevance(relevance);
|
|
+ relevance -= 0.05;
|
|
|
|
QString url = it.url().toLocalFile();
|
|
if (url.startsWith(QDir::homePath())) {
|
|
--
|
|
2.1.2
|
|
|