diff --git a/theme/fetch-ai-docs/components/instant-algolia-search.tsx b/theme/fetch-ai-docs/components/instant-algolia-search.tsx
index fb93f077..8961444a 100644
--- a/theme/fetch-ai-docs/components/instant-algolia-search.tsx
+++ b/theme/fetch-ai-docs/components/instant-algolia-search.tsx
@@ -12,32 +12,23 @@ import { getComponents } from "../mdx-components";
import { useConfig } from "../contexts";
import { remark } from "remark";
import remarkHTML from "remark-html";
-import type { Item as NormalItem } from "nextra/normalize-pages";
import { Input } from "./input";
import Modal from "./search-model";
import { DarkShortcut, Shortcut } from "src/icons/shared-icons";
import { useTheme } from "next-themes";
import { ThemeMode } from "../helpers";
-type MyItem = NormalItem & {
- tags?: string[];
-};
-
const searchClient = algoliasearch(
- `${process.env.NEXT_PUBLIC_ALGOLIA_APP_ID}`,
- `${process.env.NEXT_PUBLIC_ALGOLIA_API_KEY}`,
+ `4MNO2TMYQ5`, //4MNO2TMYQ5
+ `79f05f43517b76c1b8af1c6c667dbaba`,
);
-const indexName = `${process.env.NEXT_PUBLIC_ALGOLIA_INDEX}`;
+const indexName = `Fetch ai Docs`;
const markdownToHTML = (markdownString) => {
return remark().use(remarkHTML).processSync(markdownString).toString();
};
-export const InstantAlgoliaSearch = ({
- directories,
-}: {
- directories: MyItem[];
-}) => {
+export const InstantAlgoliaSearch = () => {
const config = useConfig();
const router = useRouter();
const [modalIsOpen, setModalIsOpen] = useState(false);
@@ -69,8 +60,8 @@ export const InstantAlgoliaSearch = ({
}
}
- const actualPath = path.split("/docs")[1];
- router.push(actualPath);
+ // const actualPath = path.split("/docs")[1];
+ router.push(path);
setModalIsOpen(false);
};
@@ -107,121 +98,59 @@ export const InstantAlgoliaSearch = ({
);
};
- const directoriesWithTags = directories
- .filter((directory) => !!("tags" in directory))
- .map(({ route, tags }) => ({ route, tags }));
-
const CustomHits = connectHits(({ hits }) => {
if (hits.length <= 0) {
return ;
}
- const groupedHits = {};
-
- for (const hit of hits) {
- const route = hit.path.split("#")[0];
-
- if (!groupedHits[route]) {
- groupedHits[route] = [];
- }
-
- groupedHits[route].push(hit);
- }
-
- const tagColors = [
- "bg-indigo",
- "bg-orange",
- "bg-light-green",
- "bg-blue-150",
- "bg-yellow-150",
- "bg-red-150",
- ];
-
return (
-
- {Object.entries(groupedHits).map(([route, hitsForRoute]) => (
-
-
-
- {route.split("/").pop()}
- {directoriesWithTags.map((directory) => {
- if (route.includes(directory.route)) {
- return (
-
-
- {directory.tags.slice(0, 3).map((tag, index) => (
-
- {tag}
-
- ))}
-
-
- );
- }
- return null;
- })}
-
-
-
-
- {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- (hitsForRoute as any[]).map((hit) => (
- -
-
onClickSearchResult(hit.path)}
- >
-
-
- {hit.title.replaceAll("#", "")}
-
-
- {hit.content.length > 0 && (
-
-
- 500 ? "..." : ""}`,
- }}
- />
-
-
- )}
-
- {hit.path
- .replace(/^\/docs\//, "")
- .split("/")
- .join(" > ")}
-
-
+
+
+ {hits.map((hit) => (
+ -
+
onClickSearchResult(hit.url)}
+ >
+
+
+ {hit.anchor || hit.hierarchy.lvl1 || hit.hierarchy.lvl0}
+
+
+ {hit.content && hit.content.length > 0 && (
+
+
+ 500 ? "..." : ""}`,
+ }}
+ />
+
-
-
- ))
- }
-
-
- ))}
+ )}
+
+ {hit.url}
+
+
+
+
+
+ ))}
+
);
});
diff --git a/theme/fetch-ai-docs/components/navbar.tsx b/theme/fetch-ai-docs/components/navbar.tsx
index f741b46e..863406fd 100644
--- a/theme/fetch-ai-docs/components/navbar.tsx
+++ b/theme/fetch-ai-docs/components/navbar.tsx
@@ -270,11 +270,11 @@ export function Navbar({ items }: NavBarProps): ReactElement {
})}
- {/*
+
{renderComponent(config.search.component, {
- directories: flatDirectories,
+ directories: [],
})}
-
*/}
+
{/*
{openOs && (
@@ -306,7 +306,7 @@ export function Navbar({ items }: NavBarProps): ReactElement {
{/*
{renderComponent(config.search.component, {
- directories: flatDirectories,
+ directories: [],
// className: "md:nx-hidden nx-mt-6 nx-mb-2",
})}
*/}
diff --git a/theme/fetch-ai-docs/constants.tsx b/theme/fetch-ai-docs/constants.tsx
index 8bf2e0b4..c7a3133f 100644
--- a/theme/fetch-ai-docs/constants.tsx
+++ b/theme/fetch-ai-docs/constants.tsx
@@ -268,8 +268,8 @@ export const DEFAULT_THEME: DocsThemeConfig = {
),
},
search: {
- component: function Search({ directories }) {
- return
;
+ component: function Search() {
+ return
;
},
emptyResult: (