diff options
| author | Géry Debongnie <ged@odoo.com> | 2016-05-04 14:43:13 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2016-05-04 14:46:46 +0200 |
| commit | 782a4466febda566f871ecf23000526893c2febd (patch) | |
| tree | 1cdf3706b4f7ed319691de105995a278f12508fa /addons/web/static/lib/fuzzy-master | |
| parent | 51064be4b307aac50184d8684cb90501132f6a24 (diff) | |
[IMP] web: better fuzzy search
The goal of this commit is to have better search results when fuzzy
searching. Before this commit, the position of a match was irrelevant
to the search results. After, a match in a first position has more
weight than a match in last position. This is better, because we often
want to find results using the first letters.
This is controversial, but I could not find a better way to do this
without rewriting the whole library myself (which might not be a bad
idea, it is only 50 lines long)
Diffstat (limited to 'addons/web/static/lib/fuzzy-master')
| -rw-r--r-- | addons/web/static/lib/fuzzy-master/fuzzy.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/web/static/lib/fuzzy-master/fuzzy.js b/addons/web/static/lib/fuzzy-master/fuzzy.js index d1805ff7ee8..0103eaa85bc 100644 --- a/addons/web/static/lib/fuzzy-master/fuzzy.js +++ b/addons/web/static/lib/fuzzy-master/fuzzy.js @@ -61,7 +61,7 @@ fuzzy.match = function(pattern, string, opts) { patternIdx += 1; // consecutive characters should increase the score more than linearly - currScore += 1 + currScore; + currScore += 1 + currScore - idx/1000; } else { currScore = 0; } |
