From 455586a3360d8e124b0724db2edc0b778b82123a Mon Sep 17 00:00:00 2001 From: Paul Tran-Van Date: Thu, 27 Jun 2024 09:58:30 +0200 Subject: [PATCH] feat: Stricter fuzzy matching We noticed that the current search is a bit too permissive and can return too many false-positive. Thus, we reduce the fuzzy matching threshold to be more strict. --- src/helpers/search.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/helpers/search.js b/src/helpers/search.js index 4c0a1a17d..9710f1bfb 100644 --- a/src/helpers/search.js +++ b/src/helpers/search.js @@ -3,9 +3,13 @@ import debounce from 'lodash/debounce' import flag from 'cozy-flags' +// See https://www.fusejs.io/api/options.html#threshold +// 0.0 is exact-matching, 1.0 is * +const DEFAULT_FUZZY_THRESHOLD = 0.1 + const fuseOptions = { findAllMatches: true, - threshold: 0.3, + threshold: DEFAULT_FUZZY_THRESHOLD, ignoreLocation: true, ignoreFieldNorm: true, keys: [