From 8bda363b99dd0fd22315905c190b450e6fef4b30 Mon Sep 17 00:00:00 2001 From: bobinstein Date: Wed, 10 Apr 2024 16:45:11 -0400 Subject: [PATCH] feat: Added indexed full text search --- docs/package.json | 3 +- docs/src/.vuepress/config.js | 4 +- .../theme/components/SearchModal.vue | 162 ++++++++---- .../theme/components/SidebarGroup.vue | 2 +- .../search-dependencies/flexsearchSvc.js | 242 ++++++++++++++++++ .../search-dependencies/matchQuery.js | 41 +++ docs/src/.vuepress/theme/layouts/Layout.vue | 35 +++ docs/yarn.lock | 31 ++- 8 files changed, 469 insertions(+), 51 deletions(-) create mode 100644 docs/src/.vuepress/theme/components/search-dependencies/flexsearchSvc.js create mode 100644 docs/src/.vuepress/theme/components/search-dependencies/matchQuery.js diff --git a/docs/package.json b/docs/package.json index ecd11ac..afec121 100644 --- a/docs/package.json +++ b/docs/package.json @@ -17,7 +17,8 @@ "devDependencies": { "gh-pages": "^5.0.0", "vuepress": "^1.5.3", - "vuepress-plugin-code-copy": "^1.0.6" + "vuepress-plugin-code-copy": "^1.0.6", + "vuepress-plugin-fulltext-search": "^2.2.1" }, "dependencies": { "vuex": "^4.1.0" diff --git a/docs/src/.vuepress/config.js b/docs/src/.vuepress/config.js index 0f6d4e2..3ae79b8 100644 --- a/docs/src/.vuepress/config.js +++ b/docs/src/.vuepress/config.js @@ -54,7 +54,7 @@ module.exports = { * ref:https://v1.vuepress.vuejs.org/theme/default-theme-config.html */ themeConfig: { - searchPlaceholder: "Search", + searchPlaceholder: "Ctrl + K", repo: "", editLinks: false, docsDir: "", @@ -74,5 +74,5 @@ module.exports = { /** * Apply plugins,ref:https://v1.vuepress.vuejs.org/zh/plugin/ */ - plugins: ["@vuepress/plugin-back-to-top", "@vuepress/plugin-medium-zoom", 'vuepress-plugin-code-copy'], + plugins: ["@vuepress/plugin-back-to-top", "@vuepress/plugin-medium-zoom", 'vuepress-plugin-code-copy', 'fulltext-search'], }; diff --git a/docs/src/.vuepress/theme/components/SearchModal.vue b/docs/src/.vuepress/theme/components/SearchModal.vue index 6aa77b5..a0fad7d 100644 --- a/docs/src/.vuepress/theme/components/SearchModal.vue +++ b/docs/src/.vuepress/theme/components/SearchModal.vue @@ -31,9 +31,12 @@ > {{ s.title || s.path }} - > {{ s.header.title }} + > {{ s.header }} + @@ -43,7 +46,8 @@