From 14ebf05e43d0286618300ec89ed1c40a10918159 Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Wed, 19 May 2010 09:51:21 +0000 Subject: [PATCH] Saturates the relevance boost given to already run matches; this avoids very commonly selected matches (e.g. konsole) to beat any other match even if the latter is in principle more relevant svn path=/trunk/KDE/kdelibs/; revision=1128445 --- runnercontext.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runnercontext.cpp b/runnercontext.cpp index 05582c830..5d57540d9 100644 --- a/runnercontext.cpp +++ b/runnercontext.cpp @@ -19,6 +19,8 @@ #include "runnercontext.h" +#include + #include #include @@ -375,8 +377,9 @@ bool RunnerContext::addMatches(const QString &term, const QList &mat LOCK_FOR_WRITE(d) foreach (QueryMatch match, matches) { // Give previously launched matches a slight boost in relevance + // The boost smoothly saturates to 0.5; if (int count = d->launchCounts.value(match.id())) { - match.setRelevance(match.relevance() + 0.05 * count); + match.setRelevance(match.relevance() + 0.5 * (1-exp(-count*0.3))); } d->matches.append(match);