mirror of https://github.com/halo-dev/halo-admin
perf: improve the indexing threshold for the fuse search engine (#849)
#### What type of PR is this? /kind improvement #### What this PR does / why we need it: 优化 Console 端使用 fuse.js 搜索引擎的搜索阈值,解决搜索关键词匹配的问题。 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/3289 #### Screenshots: before: ![image](https://user-images.githubusercontent.com/21301288/218301830-9cc0ac6e-994c-4994-9701-28e50cc90fa3.png) after: <img width="676" alt="image" src="https://user-images.githubusercontent.com/21301288/218301848-0883bbe7-f2ad-4ccb-8802-74920d76ebe0.png"> #### Special notes for your reviewer: 测试方式: 1. 检查 Console 端全局搜索,以及用户/权限管理的搜索是否符合预期。 #### Does this PR introduce a user-facing change? ```release-note 优化 Console 端全局搜索的匹配规则。 ```pull/852/head
parent
047e221ed6
commit
8209e1497e
|
@ -56,6 +56,7 @@ watch(
|
|||
fuse = new Fuse(categories.value, {
|
||||
keys: ["spec.displayName", "metadata.name"],
|
||||
useExtendedSearch: true,
|
||||
threshold: 0.2,
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -52,6 +52,7 @@ watch(
|
|||
fuse = new Fuse(tags.value, {
|
||||
keys: ["spec.displayName", "metadata.name", "spec.email"],
|
||||
useExtendedSearch: true,
|
||||
threshold: 0.2,
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -51,6 +51,7 @@ watch(
|
|||
fuse = new Fuse(users.value, {
|
||||
keys: ["spec.displayName", "metadata.name", "spec.email"],
|
||||
useExtendedSearch: true,
|
||||
threshold: 0.2,
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -54,6 +54,7 @@ const selectedIndex = ref(0);
|
|||
const fuse = new Fuse(searchableItem, {
|
||||
keys: ["title", "group", "route.path", "route.name"],
|
||||
useExtendedSearch: true,
|
||||
threshold: 0.2,
|
||||
});
|
||||
|
||||
const searchResults = computed((): SearchableItem[] => {
|
||||
|
|
|
@ -52,6 +52,7 @@ watch(
|
|||
fuse = new Fuse(value, {
|
||||
keys: ["spec.displayName", "metadata.name"],
|
||||
useExtendedSearch: true,
|
||||
threshold: 0.2,
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -78,6 +78,7 @@ const handleFetchUsers = async (options?: { mute?: boolean }) => {
|
|||
fuse = new Fuse(data.items, {
|
||||
keys: ["spec.displayName", "metadata.name", "spec.email"],
|
||||
useExtendedSearch: true,
|
||||
threshold: 0.2,
|
||||
});
|
||||
|
||||
const deletedUsers = users.value.items.filter(
|
||||
|
|
Loading…
Reference in New Issue