diff options
| author | Stephen Blott | 2012-11-03 10:57:36 +0000 |
|---|---|---|
| committer | Stephen Blott | 2012-11-03 10:57:36 +0000 |
| commit | d9e0ba4f0a06b5f5543a4398434399497573336d (patch) | |
| tree | c086ab70316b7e8ee64d6b154a0f4ffda519b061 /background_scripts | |
| parent | 2b1e7b1208bbd9c8e4dc0635163c810cc0c46316 (diff) | |
| download | vimium-d9e0ba4f0a06b5f5543a4398434399497573336d.tar.bz2 | |
Bug fix. Not all query terms matched.
Additionally, add relevant test cases.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/completion.coffee | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index b0c04cce..ffc824ba 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -251,12 +251,15 @@ class MultiCompleter RankingUtils = # Whether the given things (usually URLs or titles) match any one of the query terms. # This is used to prune out irrelevant suggestions before we try to rank them, and for calculating word relevancy. + # Every term must match at least one thing. matches: (queryTerms, things...) -> for term in queryTerms regexp = RegexpCache.get(term) + matchedTerm = false for thing in things - return true if thing?.match && thing.match regexp - false + matchedTerm = matchedTerm || (thing?.match && thing.match regexp) + return false unless matchedTerm + true # Returns a number between [0, 1] indicating how often the query terms appear in the url and title. wordRelevancy: (queryTerms, url, title) -> |
