fix: tweak search
This commit is contained in:
@@ -78,7 +78,24 @@ export default defineConfig({
|
||||
themeConfig: {
|
||||
search: {
|
||||
options: {
|
||||
miniSearch: { searchOptions: { combineWith: "AND" } },
|
||||
miniSearch: {
|
||||
searchOptions: {
|
||||
combineWith: "AND",
|
||||
fuzzy: false,
|
||||
// @ts-ignore
|
||||
boostDocument: (_, term, storedFields: Record<string, string | string[]>) => {
|
||||
const titles = (storedFields?.titles as string[])
|
||||
.filter((t) => !!t)
|
||||
.map((t) => t.toLowerCase());
|
||||
// Uprate if term appears in titles. Add bonus for higher levels (i.e. lower index)
|
||||
const titleIndex =
|
||||
titles.map((t, i) => (t?.includes(term) ? i : -1)).find((i) => i >= 0) ?? -1;
|
||||
if (titleIndex >= 0) return 10000 - titleIndex;
|
||||
|
||||
return 1;
|
||||
},
|
||||
},
|
||||
},
|
||||
detailedView: true,
|
||||
},
|
||||
provider: "local",
|
||||
|
@@ -13,10 +13,10 @@ export const commitRef = process.env.COMMIT_REF
|
||||
process.env.COMMIT_REF
|
||||
}">${process.env.COMMIT_REF.slice(0, 8)}</a>`
|
||||
: process.env.CF_PAGES
|
||||
? `<a href="https://github.com/fmhy/FMHYEdit/commit/${
|
||||
process.env.CF_PAGES_COMMIT_SHA
|
||||
}">${process.env.CF_PAGES_COMMIT_SHA.slice(0, 8)}</a>`
|
||||
: "dev";
|
||||
? `<a href="https://github.com/fmhy/FMHYEdit/commit/${
|
||||
process.env.CF_PAGES_COMMIT_SHA
|
||||
}">${process.env.CF_PAGES_COMMIT_SHA.slice(0, 8)}</a>`
|
||||
: "dev";
|
||||
|
||||
export const socials: DefaultTheme.SocialLink[] = [
|
||||
{ icon: "github", link: "https://github.com/fmhy/FMHYEdit" },
|
||||
|
Reference in New Issue
Block a user