chore: use selfhosted-meilisearch as docs search engine (#357)

使用自建的 Meilisearch 作为文档搜索引擎,代替 Algolia。

/kind improvement

```release-note
None
```
wan92hen-patch-1
Ryan Wang 6 months ago committed by GitHub
parent 23a1936cbb
commit b4e637b4b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -193,12 +193,6 @@ const config = {
darkTheme: darkCodeTheme,
additionalLanguages: ["java"],
},
algolia: {
apiKey: "739f2a55c6d13d93af146c22a4885669",
indexName: "docs",
contextualSearch: true,
appId: "OG53LY1OQH",
},
zoom: {
selector: ".markdown :not(a) > img",
},

@ -27,6 +27,7 @@
"docusaurus-plugin-image-zoom": "^1.0.1",
"file-loader": "^6.2.0",
"hast-util-is-element": "1.1.0",
"meilisearch-docsearch": "^0.6.0",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",

@ -38,6 +38,9 @@ dependencies:
hast-util-is-element:
specifier: 1.1.0
version: 1.1.0
meilisearch-docsearch:
specifier: ^0.6.0
version: 0.6.0
prism-react-renderer:
specifier: ^1.3.5
version: 1.3.5(react@17.0.2)
@ -5166,6 +5169,14 @@ packages:
- encoding
dev: false
/cross-fetch@3.1.8:
resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==}
dependencies:
node-fetch: 2.7.0
transitivePeerDependencies:
- encoding
dev: false
/cross-spawn@7.0.3:
resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
engines: {node: '>= 8'}
@ -5392,6 +5403,10 @@ packages:
/csstype@3.0.10:
resolution: {integrity: sha512-2u44ZG2OcNUO9HDp/Jl8C07x6pU/eTR3ncV91SiK3dhG9TWvRVsCoJw14Ckx5DgWkzGA3waZWO3d7pgqpUI/XA==}
/csstype@3.1.3:
resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}
dev: false
/debug@2.6.9:
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
peerDependencies:
@ -7278,6 +7293,23 @@ packages:
resolution: {integrity: sha512-CjFVuFq/IfrdqesAXfg+hzlDKu6A2n80ZIq0Kl9kWjoHh9j1N9Uvk5X0/MmN0hOfm5F9YBswlClhcwnmtwz7gA==}
dev: false
/meilisearch-docsearch@0.6.0:
resolution: {integrity: sha512-Pq61rCNIrwxMZ2vGc7ZkPUJSv92hPz1xPqy/jbDXmmA5GLSje6n98dotiUC9TKGzeRrG7DYCNbCjjdrlyoi8Bg==}
dependencies:
meilisearch: 0.35.0
solid-js: 1.8.5
transitivePeerDependencies:
- encoding
dev: false
/meilisearch@0.35.0:
resolution: {integrity: sha512-gF1I6K5/Wpe7BWfjBnG+o19y/FIpJ9HbN+byON6CB9U3uE7qc6GvwUbjKOllh7LKXQVVxH/kCu7Jn0ODCUwqbQ==}
dependencies:
cross-fetch: 3.1.8
transitivePeerDependencies:
- encoding
dev: false
/memfs@3.4.1:
resolution: {integrity: sha512-1c9VPVvW5P7I85c35zAdEr1TD5+F11IToIHIlrVIcflfnzPkJa0ZoYEoEdYDP8KgPFoSZ/opDrUsAoZWym3mtw==}
engines: {node: '>= 4.0.0'}
@ -7473,6 +7505,18 @@ packages:
whatwg-url: 5.0.0
dev: false
/node-fetch@2.7.0:
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
engines: {node: 4.x || >=6.0.0}
peerDependencies:
encoding: ^0.1.0
peerDependenciesMeta:
encoding:
optional: true
dependencies:
whatwg-url: 5.0.0
dev: false
/node-forge@1.2.1:
resolution: {integrity: sha512-Fcvtbb+zBcZXbTTVwqGA5W+MKBj56UjVRevvchv5XrcyXbmNdesfZL37nlcWOfpgHhgmxApw3tQbTr4CqNmX4w==}
engines: {node: '>= 6.13.0'}
@ -9007,6 +9051,11 @@ packages:
dependencies:
randombytes: 2.1.0
/seroval@0.12.4:
resolution: {integrity: sha512-JIsZHp98o+okpYN8HEPyI9Blr0gxAUPIGvg3waXrEMFjPz9obiLYMz0uFiUGezKiCK8loosYbn8WsqO8WtAJUA==}
engines: {node: '>=10'}
dev: false
/serve-handler@6.1.3:
resolution: {integrity: sha512-FosMqFBNrLyeiIDvP1zgO6YoTzFYHxLDEIavhlmQ+knB2Z7l1t+kGLHkZIDN7UVWqQAmKI3D20A6F6jo3nDd4w==}
dependencies:
@ -9147,6 +9196,13 @@ packages:
websocket-driver: 0.7.4
dev: false
/solid-js@1.8.5:
resolution: {integrity: sha512-xvtJvzJzWbsn35oKFhW9kNwaxG1Z/YLMsDp4tLVcYZTMPzvzQ8vEZuyDQ6nt7xDArVgZJ7TUFrJUwrui/oq53A==}
dependencies:
csstype: 3.1.3
seroval: 0.12.4
dev: false
/sort-css-media-queries@2.0.4:
resolution: {integrity: sha512-PAIsEK/XupCQwitjv7XxoMvYhT7EAfyzI3hsy/MyDgTvc+Ft55ctdkctJLOy6cQejaIC+zjpUL4djFVm2ivOOw==}
engines: {node: '>= 6.3.0'}

@ -0,0 +1,25 @@
import React, { useEffect } from "react";
import "meilisearch-docsearch/css";
export default function SearchBarWrapper(props) {
useEffect(() => {
const docsearch = require("meilisearch-docsearch").default;
const destroy = docsearch({
container: "#docsearch",
host: "https://docsearch.halo.run",
// Default Search API Key
// Use it to search from the frontend
apiKey:
"4b16205faa360eaa1ee5add67c0d265a4ca1e898ffbea199fe23d487a24c9bc8",
indexUid: "docs",
});
return () => destroy();
}, []);
return (
<>
<div id="docsearch"></div>
</>
);
}
Loading…
Cancel
Save