Skip to content

Commit

Permalink
Merge pull request #5 from gnolang/feat/search-engine
Browse files Browse the repository at this point in the history
feat: search engine
  • Loading branch information
albttx authored Mar 20, 2024
2 parents e585293 + 58a3cfe commit 2af8603
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docusaurus/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ const config = {
srcDark: "img/gnoland_light.svg",
},
items: [
{
type: "search",
position: "right",
},
{
position: "left",
label: "Home",
Expand Down
1 change: 1 addition & 0 deletions docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@docusaurus/preset-classic": "2.4.1",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"meilisearch-docsearch": "^0.6.0",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2"
Expand Down
22 changes: 22 additions & 0 deletions docusaurus/src/theme/SearchBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React, { useEffect } from "react";
// import "./style.css";
import "meilisearch-docsearch/css";

export default function Component() {
useEffect(() => {
const lang = document.querySelector("html").lang || "en";

const docsearch = require("meilisearch-docsearch").default;
const destroy = docsearch({
host: "HOST_VAR",
apiKey: "API_VAR",
indexUid: "docs-v1",
container: "#docsearch",
// searchParams: {filter: [`lang = ${lang}`]},
});

return () => destroy();
}, []);

return <div id="docsearch" />;
}
32 changes: 30 additions & 2 deletions docusaurus/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3221,7 +3221,7 @@ cosmiconfig@^8.3.5:
parse-json "^5.2.0"
path-type "^4.0.0"

cross-fetch@^3.1.5:
cross-fetch@^3.1.5, cross-fetch@^3.1.6:
version "3.1.8"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82"
integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==
Expand Down Expand Up @@ -3381,7 +3381,7 @@ csso@^4.2.0:
dependencies:
css-tree "^1.1.2"

csstype@^3.0.2:
csstype@^3.0.2, csstype@^3.1.0:
version "3.1.3"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
Expand Down Expand Up @@ -5172,6 +5172,21 @@ [email protected]:
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==

meilisearch-docsearch@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/meilisearch-docsearch/-/meilisearch-docsearch-0.6.0.tgz#e070a515f161fad5f84590dfda27fafa846721d5"
integrity sha512-Pq61rCNIrwxMZ2vGc7ZkPUJSv92hPz1xPqy/jbDXmmA5GLSje6n98dotiUC9TKGzeRrG7DYCNbCjjdrlyoi8Bg==
dependencies:
meilisearch "0.35.0"
solid-js "1.8.5"

[email protected]:
version "0.35.0"
resolved "https://registry.yarnpkg.com/meilisearch/-/meilisearch-0.35.0.tgz#c94d5f266e39ad5ed5a666782e729805a4e8a956"
integrity sha512-gF1I6K5/Wpe7BWfjBnG+o19y/FIpJ9HbN+byON6CB9U3uE7qc6GvwUbjKOllh7LKXQVVxH/kCu7Jn0ODCUwqbQ==
dependencies:
cross-fetch "^3.1.6"

memfs@^3.1.2, memfs@^3.4.3:
version "3.6.0"
resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.6.0.tgz#d7a2110f86f79dd950a8b6df6d57bc984aa185f6"
Expand Down Expand Up @@ -6688,6 +6703,11 @@ serialize-javascript@^6.0.0, serialize-javascript@^6.0.1:
dependencies:
randombytes "^2.1.0"

seroval@^0.12.0:
version "0.12.4"
resolved "https://registry.yarnpkg.com/seroval/-/seroval-0.12.4.tgz#f680d82f1ab7129e4374f28a122ec01925571e86"
integrity sha512-JIsZHp98o+okpYN8HEPyI9Blr0gxAUPIGvg3waXrEMFjPz9obiLYMz0uFiUGezKiCK8loosYbn8WsqO8WtAJUA==

serve-handler@^6.1.3:
version "6.1.5"
resolved "https://registry.yarnpkg.com/serve-handler/-/serve-handler-6.1.5.tgz#a4a0964f5c55c7e37a02a633232b6f0d6f068375"
Expand Down Expand Up @@ -6848,6 +6868,14 @@ sockjs@^0.3.24:
uuid "^8.3.2"
websocket-driver "^0.7.4"

[email protected]:
version "1.8.5"
resolved "https://registry.yarnpkg.com/solid-js/-/solid-js-1.8.5.tgz#60c68cb67feafa84c2c3f38dd2050adeef31cde1"
integrity sha512-xvtJvzJzWbsn35oKFhW9kNwaxG1Z/YLMsDp4tLVcYZTMPzvzQ8vEZuyDQ6nt7xDArVgZJ7TUFrJUwrui/oq53A==
dependencies:
csstype "^3.1.0"
seroval "^0.12.0"

[email protected]:
version "2.1.0"
resolved "https://registry.yarnpkg.com/sort-css-media-queries/-/sort-css-media-queries-2.1.0.tgz#7c85e06f79826baabb232f5560e9745d7a78c4ce"
Expand Down

0 comments on commit 2af8603

Please sign in to comment.