diff options
| author | Phil Crosby | 2012-05-26 12:49:16 -0700 |
|---|---|---|
| committer | Phil Crosby | 2012-05-26 22:27:27 -0700 |
| commit | e1574aa50968cdaaf34abc9259af572a97700fbb (patch) | |
| tree | 2d151928a73937ba00d495ca645b135eab56d376 | |
| parent | 564647247d4420acf6eb7ff2cf56e763c24384df (diff) | |
| download | vimium-e1574aa50968cdaaf34abc9259af572a97700fbb.tar.bz2 | |
Ignore any matches between the query and the target which are 2 characters are less.
| -rw-r--r-- | background_scripts/completion.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/background_scripts/completion.js b/background_scripts/completion.js index 8bdbc637..2e78ac9d 100644 --- a/background_scripts/completion.js +++ b/background_scripts/completion.js @@ -137,6 +137,7 @@ var completion = (function() { var displayUrl = this.stripTrailingSlash(url); function createLazyCompletion(query) { + // We want shorter URLs (i.e. top level domains) to rank more highly. var relevancy = url.length / fuzzyMatcher.calculateRelevancy(query, completionString); return new LazyCompletionResult(relevancy, function() { return { @@ -436,9 +437,11 @@ 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 + // Ignore any matches between the query and the str which are 2 characters are less. + var minimumCharacterMatch = 3; + // only iterate over slices of the query starting at an offset up to 20 to save resources for (var start = 0; start < 20 && start < query.length; ++start) { - for (var i = query.length; i >= start; --i) { + for (var i = query.length; i >= start + (minimumCharacterMatch - 1); --i) { if (str.indexOf(query.slice(start, i)) >= 0) { var length = i - start; sum += length * length; |
