From e6e00dcfd0bad537b59ec0a891d7c7c873ea8e99 Mon Sep 17 00:00:00 2001 From: Elsio Sanchez Date: Fri, 8 Sep 2023 10:27:34 -0400 Subject: [PATCH] Fix: Search with exact match --- components/HeaderSearch/index.vue | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/components/HeaderSearch/index.vue b/components/HeaderSearch/index.vue index a9b48fb8..6920f21a 100644 --- a/components/HeaderSearch/index.vue +++ b/components/HeaderSearch/index.vue @@ -156,22 +156,36 @@ export default { }) }, initFuse(list) { + // this.fuse = new Fuse(list, { + // shouldSort: true, + // threshold: 0.4, + // location: 0, + // distance: 100, + // maxPatternLength: 32, + // minMatchCharLength: 1, + // keys: [{ + // name: 'title', + // weight: 0.9 + // }, { + // name: 'pinyinTitle', + // weight: 0.1 + // }, { + // name: 'path', + // weight: 0.1 + // }] + // }) this.fuse = new Fuse(list, { + // isCaseSensitive: true, + includeScore: true, shouldSort: true, threshold: 0.4, - location: 0, + location: 5, distance: 100, maxPatternLength: 32, minMatchCharLength: 1, keys: [{ name: 'title', weight: 0.7 - }, { - name: 'pinyinTitle', - weight: 0.3 - }, { - name: 'path', - weight: 0.3 }] }) },