aboutsummaryrefslogtreecommitdiffstats
path: root/lib/completion.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/completion.js')
-rw-r--r--lib/completion.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/completion.js b/lib/completion.js
index 126790ff..5950a1ca 100644
--- a/lib/completion.js
+++ b/lib/completion.js
@@ -61,13 +61,12 @@ var completion = (function() {
str = self.normalize(str);
var sum = 0;
// only iterate over slices of the query starting at an offset up to 10 to save resources
- for (var start = 0; start < 20; ++start) {
+ for (var start = 0; start < 20 && start < query.length; ++start) {
for (var i = query.length; i >= start; --i) {
if (str.indexOf(query.slice(start, i)) >= 0) {
- sum += i - start;
+ sum += (i - start) * (i - start);
break;
}
-
}
}
return sum * sum * sum;
@@ -256,7 +255,7 @@ var completion = (function() {
refresh: function() { },
calculateRelevancy: function(query, match) {
- return match.url.length * 10 /
+ return match.url.length /
(fuzzyMatcher.calculateRelevancy(query, this.extractStringFromMatch(match)) + 1);
},