From 54eb82ad79c3bfea7979ca8d4d416f7be3c2cbb7 Mon Sep 17 00:00:00 2001 From: Dens Sumesh Date: Fri, 1 Nov 2024 14:18:17 -0700 Subject: [PATCH 1/2] feature: add trieve search integration --- .../content/docs/headless/search/trieve.mdx | 168 +++++++++++ apps/docs/content/docs/ui/search.mdx | 27 ++ examples/next-mdx/app/static.json/trieve.ts | 22 ++ examples/next-mdx/package.json | 3 +- pnpm-lock.yaml | 273 ++++++++++++++++++ 5 files changed, 492 insertions(+), 1 deletion(-) create mode 100644 apps/docs/content/docs/headless/search/trieve.mdx create mode 100644 examples/next-mdx/app/static.json/trieve.ts diff --git a/apps/docs/content/docs/headless/search/trieve.mdx b/apps/docs/content/docs/headless/search/trieve.mdx new file mode 100644 index 00000000..04789d72 --- /dev/null +++ b/apps/docs/content/docs/headless/search/trieve.mdx @@ -0,0 +1,168 @@ +--- +title: Trieve Search +description: Integrate Trieve Search with Fumadocs +--- + +## Introduction + +The Trieve Integration automatically configures Trieve Search for site search. + +By default, it creates a chunk for **each paragraph** in your document, it is +officially recommended by Trieve. + +## Setup + +### Install Dependencies + +```package-install +trieve-ts-sdk trieve-fumadocs-adapter +``` + +### Sign up on Trieve + +Sign up and create a dataset. Then obtain 2 API keys where one has only read access and the other has admin access to create and delete chunks. +Store these credentials in environment variables. + + + One API Key should have only read access for the public facing search and the + other should have admin access to create and delete chunks. + + +### Sync Dataset + +The `sync` function will sync search indexes. + +```js title="update-index.mjs" +import { sync } from 'trieve-fumadocs-adapter/search/sync'; +import { TrieveSDK } from 'trieve-ts-sdk'; + +const client = new TrieveSDK({ + apiKey: 'adminApiKey', + datasetId: 'datasetId', +}); + +sync(client, records); +``` + +You can export the search indexes from Next.js using a route handler: + +```json doc-gen:file +{ + "file": "../../examples/next-mdx/app/static.json/trieve.ts", + "codeblock": { + "meta": "title=\"app/static.json/route.ts\"" + } +} +``` + +```js title="update-index.mjs" +import * as fs from 'node:fs'; + +const content = fs.readFileSync('.next/server/app/static.json.body'); + +// now you can pass it to `sync` +/** @type {import('trieve-fumadocs-adapter/search/sync').TrieveDocument[]} **/ +const records = JSON.parse(content.toString()); +``` + +Make sure to run the script after build: + +```json title="package.json" +{ + "scripts": { + "build": "next build && node ./update-index.mjs" + } +} +``` + +### Workflow + +You may make it a script and manually sync with `node ./update-index.mjs`, or +integrate it with your CI/CD pipeline. + +> Notice that it expects the `url` property of a page to be unique. In other words, you shouldn't have two pages with the same +> url. + + + If you are running the script with [TSX](https://github.com/privatenumber/tsx) + or other similar Typescript executors, ensure to name it `.mts` for best ESM + compatibility. + + +### Search Client + +To search documents on the client side, use [Fumadocs UI Search Dialog](/docs/ui/search#trieve), or make your own implementation. + +In addition, the headless search client of Fumadocs can handle state management for React. + +```ts +import { TrieveSDK } from 'trieve-ts-sdk'; +import { useTrieveSearch } from 'fumadocs-core/search/client'; + +const client = new TrieveSDK({ + apiKey: 'readOnlyApiKey', + datasetId: 'datasetId', +}); + +const { search, setSearch, query } = useTrieveSearch(client); +``` + +## Options + +### Tag Filter + +To configure tag filtering, add a `tag` value to indexes. + +```js +import { sync } from 'trieve-fumadocs-adapter/search/sync'; +import { TrieveSDK } from 'trieve-ts-sdk'; + +const client = new TrieveSDK({ + apiKey: 'adminApiKey', + datasetId: 'datasetId', +}); + +const documents = records.map((index) => ({ + ...index, + tag: 'value', // [!code highlight] + })), + +sync(client, documents); +``` + +#### Search UI (Fumadocs UI) [#search-ui] + +Enable [Tag Filter](/docs/ui/search#tag-filter-1) on Search Dialog. + +#### Search Client + +The `tag_set` field is an attribute for filtering. To filter indexes by tag, use the filter + +```JSON +{ + "must": [{ + "field": "tag_set", + "match": ["value"] + }] +} +``` + +on Trieve search clients. + +On Fumadocs search client, you can add the tag filter like: + +```ts +import { TrieveSDK } from 'trieve-ts-sdk'; +import { useTrieveSearch } from 'fumadocs-core/search/client'; + +const client = new TrieveSDK({ + apiKey: 'readOnlyApiKey', + datasetId: 'datasetId', +}); + +const { search, setSearch, query } = useTrieveSearch( + client, + undefined, + '', +); +``` diff --git a/apps/docs/content/docs/ui/search.mdx b/apps/docs/content/docs/ui/search.mdx index 43e7d39e..f5e962cb 100644 --- a/apps/docs/content/docs/ui/search.mdx +++ b/apps/docs/content/docs/ui/search.mdx @@ -229,6 +229,33 @@ export default function CustomSearchDialog(props: SharedProps) { +### Trieve + +For the setup guide, see [Integrate Trieve Search](/docs/headless/search/trieve). + +While generally we recommend building your own search with their client-side +SDK, you can also plug the built-in dialog interface. + +```tsx title="components/search.tsx" +'use client'; +import type { SharedProps } from 'fumadocs-ui/components/dialog/search'; +import SearchDialog from 'trieve-fumadocs-adapter/components/dialog/search'; +import { TrieveSDK } from 'trieve-ts-sdk'; + +const trieveClient = new TrieveSDK({ + apiKey: 'readOnlyApiKey', + datasetId: 'datasetId', +}); + +export default function CustomSearchDialog(props: SharedProps) { + return ; +} +``` + +1. Replace `apiKey` and `datasetId` with your desired values. + +2. [Replace the default search dialog](#replace-search-dialog) with your new component. + ### Orama Cloud For the setup guide, see [Integrate Orama Cloud](/docs/headless/search/orama-cloud). diff --git a/examples/next-mdx/app/static.json/trieve.ts b/examples/next-mdx/app/static.json/trieve.ts new file mode 100644 index 00000000..c168a658 --- /dev/null +++ b/examples/next-mdx/app/static.json/trieve.ts @@ -0,0 +1,22 @@ +import { NextResponse } from 'next/server'; +import { source } from '@/lib/source'; +import { type TrieveDocument } from 'trieve-fumadocs-adapter/search/sync'; + + +export const revalidate = false; + +export function GET() { + const results: TrieveDocument[] = []; + + for (const page of source.getPages()) { + results.push({ + _id: page.url, + structured: page.data.structuredData, + url: page.url, + title: page.data.title, + description: page.data.description, + }); + } + + return NextResponse.json(results); +} diff --git a/examples/next-mdx/package.json b/examples/next-mdx/package.json index 762cb145..a168579d 100644 --- a/examples/next-mdx/package.json +++ b/examples/next-mdx/package.json @@ -13,7 +13,8 @@ "fumadocs-ui": "workspace:*", "next": "15.0.1", "react": "18.3.1", - "react-dom": "18.3.1" + "react-dom": "18.3.1", + "trieve-fumadocs-adapter": "^1.2.3" }, "devDependencies": { "@types/mdx": "^2.0.13", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3823ebf8..3a9be99e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -320,6 +320,9 @@ importers: react-dom: specifier: 18.3.1 version: 18.3.1(react@18.3.1) + trieve-fumadocs-adapter: + specifier: ^1.2.3 + version: 1.2.3(@oramacloud/client@1.3.18(typescript@5.6.3)(zod@3.23.8))(@types/react-dom@18.3.1)(@types/react@18.3.12)(algoliasearch@4.24.0)(tailwindcss@3.4.14) devDependencies: '@types/mdx': specifier: ^2.0.13 @@ -2020,6 +2023,9 @@ packages: '@next/bundle-analyzer@15.0.2': resolution: {integrity: sha512-bV566k+rDsaqXSUgHBof0iMIDx5DWtLx/98jvYtqb9x85e+WJzv+8cpDvbjtxQMf7nFC/LUkPmpruj1cOKfz4A==} + '@next/env@14.2.4': + resolution: {integrity: sha512-3EtkY5VDkuV2+lNmKlbkibIJxcO4oIHEhBWne6PaAp+76J9KoSsGvNikp6ivzAT8dhhBMYrm6op2pS1ApG0Hzg==} + '@next/env@15.0.1': resolution: {integrity: sha512-lc4HeDUKO9gxxlM5G2knTRifqhsY6yYpwuHspBZdboZe0Gp+rZHBNNSIjmQKDJIdRXiXGyVnSD6gafrbQPvILQ==} @@ -2032,6 +2038,12 @@ packages: '@next/eslint-plugin-next@15.0.2': resolution: {integrity: sha512-R9Jc7T6Ge0txjmqpPwqD8vx6onQjynO9JT73ArCYiYPvSrwYXepH/UY/WdKDY8JPWJl72sAE4iGMHPeQ5xdEWg==} + '@next/swc-darwin-arm64@14.2.4': + resolution: {integrity: sha512-AH3mO4JlFUqsYcwFUHb1wAKlebHU/Hv2u2kb1pAuRanDZ7pD/A/KPD98RHZmwsJpdHQwfEc/06mgpSzwrJYnNg==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + '@next/swc-darwin-arm64@15.0.1': resolution: {integrity: sha512-C9k/Xv4sxkQRTA37Z6MzNq3Yb1BJMmSqjmwowoWEpbXTkAdfOwnoKOpAb71ItSzoA26yUTIo6ZhN8rKGu4ExQw==} engines: {node: '>= 10'} @@ -2044,6 +2056,12 @@ packages: cpu: [arm64] os: [darwin] + '@next/swc-darwin-x64@14.2.4': + resolution: {integrity: sha512-QVadW73sWIO6E2VroyUjuAxhWLZWEpiFqHdZdoQ/AMpN9YWGuHV8t2rChr0ahy+irKX5mlDU7OY68k3n4tAZTg==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + '@next/swc-darwin-x64@15.0.1': resolution: {integrity: sha512-uHl13HXOuq1G7ovWFxCACDJHTSDVbn/sbLv8V1p+7KIvTrYQ5HNoSmKBdYeEKRRCbEmd+OohOgg9YOp8Ux3MBg==} engines: {node: '>= 10'} @@ -2056,6 +2074,12 @@ packages: cpu: [x64] os: [darwin] + '@next/swc-linux-arm64-gnu@14.2.4': + resolution: {integrity: sha512-KT6GUrb3oyCfcfJ+WliXuJnD6pCpZiosx2X3k66HLR+DMoilRb76LpWPGb4tZprawTtcnyrv75ElD6VncVamUQ==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + '@next/swc-linux-arm64-gnu@15.0.1': resolution: {integrity: sha512-LvyhvxHOihFTEIbb35KxOc3q8w8G4xAAAH/AQnsYDEnOvwawjL2eawsB59AX02ki6LJdgDaHoTEnC54Gw+82xw==} engines: {node: '>= 10'} @@ -2068,6 +2092,12 @@ packages: cpu: [arm64] os: [linux] + '@next/swc-linux-arm64-musl@14.2.4': + resolution: {integrity: sha512-Alv8/XGSs/ytwQcbCHwze1HmiIkIVhDHYLjczSVrf0Wi2MvKn/blt7+S6FJitj3yTlMwMxII1gIJ9WepI4aZ/A==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + '@next/swc-linux-arm64-musl@15.0.1': resolution: {integrity: sha512-vFmCGUFNyk/A5/BYcQNhAQqPIw01RJaK6dRO+ZEhz0DncoW+hJW1kZ8aH2UvTX27zPq3m85zN5waMSbZEmANcQ==} engines: {node: '>= 10'} @@ -2080,6 +2110,12 @@ packages: cpu: [arm64] os: [linux] + '@next/swc-linux-x64-gnu@14.2.4': + resolution: {integrity: sha512-ze0ShQDBPCqxLImzw4sCdfnB3lRmN3qGMB2GWDRlq5Wqy4G36pxtNOo2usu/Nm9+V2Rh/QQnrRc2l94kYFXO6Q==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + '@next/swc-linux-x64-gnu@15.0.1': resolution: {integrity: sha512-5by7IYq0NCF8rouz6Qg9T97jYU68kaClHPfGpQG2lCZpSYHtSPQF1kjnqBTd34RIqPKMbCa4DqCufirgr8HM5w==} engines: {node: '>= 10'} @@ -2092,6 +2128,12 @@ packages: cpu: [x64] os: [linux] + '@next/swc-linux-x64-musl@14.2.4': + resolution: {integrity: sha512-8dwC0UJoc6fC7PX70csdaznVMNr16hQrTDAMPvLPloazlcaWfdPogq+UpZX6Drqb1OBlwowz8iG7WR0Tzk/diQ==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + '@next/swc-linux-x64-musl@15.0.1': resolution: {integrity: sha512-lmYr6H3JyDNBJLzklGXLfbehU3ay78a+b6UmBGlHls4xhDXBNZfgb0aI67sflrX+cGBnv1LgmWzFlYrAYxS1Qw==} engines: {node: '>= 10'} @@ -2104,6 +2146,12 @@ packages: cpu: [x64] os: [linux] + '@next/swc-win32-arm64-msvc@14.2.4': + resolution: {integrity: sha512-jxyg67NbEWkDyvM+O8UDbPAyYRZqGLQDTPwvrBBeOSyVWW/jFQkQKQ70JDqDSYg1ZDdl+E3nkbFbq8xM8E9x8A==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [win32] + '@next/swc-win32-arm64-msvc@15.0.1': resolution: {integrity: sha512-DS8wQtl6diAj0eZTdH0sefykm4iXMbHT4MOvLwqZiIkeezKpkgPFcEdFlz3vKvXa2R/2UEgMh48z1nEpNhjeOQ==} engines: {node: '>= 10'} @@ -2116,6 +2164,18 @@ packages: cpu: [arm64] os: [win32] + '@next/swc-win32-ia32-msvc@14.2.4': + resolution: {integrity: sha512-twrmN753hjXRdcrZmZttb/m5xaCBFa48Dt3FbeEItpJArxriYDunWxJn+QFXdJ3hPkm4u7CKxncVvnmgQMY1ag==} + engines: {node: '>= 10'} + cpu: [ia32] + os: [win32] + + '@next/swc-win32-x64-msvc@14.2.4': + resolution: {integrity: sha512-tkLrjBzqFTP8DVrAAQmZelEahfR9OxWpFR++vAI9FBhCiIxtwHwBHC23SBHCTURBtwB4kc/x44imVOnkKGNVGg==} + engines: {node: '>= 10'} + cpu: [x64] + os: [win32] + '@next/swc-win32-x64-msvc@15.0.1': resolution: {integrity: sha512-4Ho2ggvDdMKlZ/0e9HNdZ9ngeaBwtc+2VS5oCeqrbXqOgutX6I4U2X/42VBw0o+M5evn4/7v3zKgGHo+9v/VjA==} engines: {node: '>= 10'} @@ -2882,6 +2942,9 @@ packages: '@swc/helpers@0.5.13': resolution: {integrity: sha512-UoKGxQ3r5kYI9dALKJapMmuK+1zWM/H17Z1+iwnNmzcJRnfFuevZs375TA5rW31pu4BS4NoSy1fRsexDXfWn5w==} + '@swc/helpers@0.5.5': + resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==} + '@swc/types@0.1.13': resolution: {integrity: sha512-JL7eeCk6zWCbiYQg2xQSdLXQJl8Qoc9rXmG2cEKvHe3CKwMHwHGpfOb8frzNLmbycOo6I51qxnLnn9ESf4I20Q==} @@ -3944,6 +4007,37 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + fumadocs-core@14.2.0: + resolution: {integrity: sha512-cRahw/8hIox/T1drQpghn1hvN6r2hpy1Z2egU4E1xF2KaB+r16ZN6YpyGkpS1f9lziLgU8Ve2gtOiqIJwl3oCA==} + peerDependencies: + '@oramacloud/client': 1.x.x + algoliasearch: 4.24.0 + next: 14.x.x || 15.x.x + react: '>= 18' + react-dom: '>= 18' + peerDependenciesMeta: + '@oramacloud/client': + optional: true + algoliasearch: + optional: true + next: + optional: true + react: + optional: true + react-dom: + optional: true + + fumadocs-ui@14.2.0: + resolution: {integrity: sha512-ARz4W/sFie3KfiT7DS2zcPYcMw24ezQ+yFjSjK2vdiJ8G1SJ9ZTaCAkHTiNl+DC2i7FaVz7OmeLfdfDmNUSmZw==} + peerDependencies: + next: 14.x.x || 15.x.x + react: '>= 18' + react-dom: '>= 18' + tailwindcss: ^3.4.14 + peerDependenciesMeta: + tailwindcss: + optional: true + function-bind@1.1.2: resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} @@ -4802,6 +4896,24 @@ packages: react: ^16.8 || ^17 || ^18 react-dom: ^16.8 || ^17 || ^18 + next@14.2.4: + resolution: {integrity: sha512-R8/V7vugY+822rsQGQCjoLhMuC9oFj9SOi4Cl4b2wjDrseD0LRZ10W7R6Czo4w9ZznVSshKjuIomsRjvm9EKJQ==} + engines: {node: '>=18.17.0'} + hasBin: true + peerDependencies: + '@opentelemetry/api': ^1.1.0 + '@playwright/test': ^1.41.2 + react: ^18.2.0 + react-dom: ^18.2.0 + sass: ^1.3.0 + peerDependenciesMeta: + '@opentelemetry/api': + optional: true + '@playwright/test': + optional: true + sass: + optional: true + next@15.0.1: resolution: {integrity: sha512-PSkFkr/w7UnFWm+EP8y/QpHrJXMqpZzAXpergB/EqLPOh4SGPJXv1wj4mslr2hUZBAS9pX7/9YLIdxTv6fwytw==} engines: {node: '>=18.18.0'} @@ -5639,6 +5751,19 @@ packages: style-to-object@1.0.8: resolution: {integrity: sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==} + styled-jsx@5.1.1: + resolution: {integrity: sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==} + engines: {node: '>= 12.0.0'} + peerDependencies: + '@babel/core': '*' + babel-plugin-macros: '*' + react: '>= 16.8.0 || 17.x.x || ^18.0.0-0' + peerDependenciesMeta: + '@babel/core': + optional: true + babel-plugin-macros: + optional: true + styled-jsx@5.1.6: resolution: {integrity: sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==} engines: {node: '>= 12.0.0'} @@ -5775,6 +5900,12 @@ packages: resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} hasBin: true + trieve-fumadocs-adapter@1.2.3: + resolution: {integrity: sha512-6fgvBozWltLWP0J07irurGJZbcNzK00OYkcyXTzRhpOhHWxgXyofs1qxWTpUPhIi0DV5HoftYejxiC6kVDC4WQ==} + + trieve-ts-sdk@0.0.14: + resolution: {integrity: sha512-fAMZPZOPxs+ufuqQnE14dEX3Xd0RDjTBOmDqh7r4KzfHvrbCTiQimwdHgohSqmCT1/12SIqXEDVX1NUJxrNVJw==} + trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} @@ -6998,6 +7129,8 @@ snapshots: - bufferutil - utf-8-validate + '@next/env@14.2.4': {} + '@next/env@15.0.1': {} '@next/env@15.0.2': {} @@ -7010,48 +7143,75 @@ snapshots: dependencies: fast-glob: 3.3.1 + '@next/swc-darwin-arm64@14.2.4': + optional: true + '@next/swc-darwin-arm64@15.0.1': optional: true '@next/swc-darwin-arm64@15.0.2': optional: true + '@next/swc-darwin-x64@14.2.4': + optional: true + '@next/swc-darwin-x64@15.0.1': optional: true '@next/swc-darwin-x64@15.0.2': optional: true + '@next/swc-linux-arm64-gnu@14.2.4': + optional: true + '@next/swc-linux-arm64-gnu@15.0.1': optional: true '@next/swc-linux-arm64-gnu@15.0.2': optional: true + '@next/swc-linux-arm64-musl@14.2.4': + optional: true + '@next/swc-linux-arm64-musl@15.0.1': optional: true '@next/swc-linux-arm64-musl@15.0.2': optional: true + '@next/swc-linux-x64-gnu@14.2.4': + optional: true + '@next/swc-linux-x64-gnu@15.0.1': optional: true '@next/swc-linux-x64-gnu@15.0.2': optional: true + '@next/swc-linux-x64-musl@14.2.4': + optional: true + '@next/swc-linux-x64-musl@15.0.1': optional: true '@next/swc-linux-x64-musl@15.0.2': optional: true + '@next/swc-win32-arm64-msvc@14.2.4': + optional: true + '@next/swc-win32-arm64-msvc@15.0.1': optional: true '@next/swc-win32-arm64-msvc@15.0.2': optional: true + '@next/swc-win32-ia32-msvc@14.2.4': + optional: true + + '@next/swc-win32-x64-msvc@14.2.4': + optional: true + '@next/swc-win32-x64-msvc@15.0.1': optional: true @@ -7763,6 +7923,11 @@ snapshots: dependencies: tslib: 2.8.0 + '@swc/helpers@0.5.5': + dependencies: + '@swc/counter': 0.1.3 + tslib: 2.8.0 + '@swc/types@0.1.13': dependencies: '@swc/counter': 0.1.3 @@ -9120,6 +9285,61 @@ snapshots: fsevents@2.3.3: optional: true + fumadocs-core@14.2.0(@oramacloud/client@1.3.18(typescript@5.6.3)(zod@3.23.8))(@types/react@18.3.12)(algoliasearch@4.24.0)(next@14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + dependencies: + '@formatjs/intl-localematcher': 0.5.6 + '@orama/orama': 3.0.1 + '@shikijs/rehype': 1.22.2 + github-slugger: 2.0.0 + hast-util-to-estree: 3.1.0 + hast-util-to-jsx-runtime: 2.3.2 + image-size: 1.1.1 + negotiator: 1.0.0 + react-remove-scroll: 2.6.0(@types/react@18.3.12)(react@18.3.1) + remark: 15.0.1 + remark-gfm: 4.0.0 + scroll-into-view-if-needed: 3.1.0 + shiki: 1.22.2 + unist-util-visit: 5.0.0 + optionalDependencies: + '@oramacloud/client': 1.3.18(typescript@5.6.3)(zod@3.23.8) + algoliasearch: 4.24.0 + next: 14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + transitivePeerDependencies: + - '@types/react' + - supports-color + + fumadocs-ui@14.2.0(@oramacloud/client@1.3.18(typescript@5.6.3)(zod@3.23.8))(@types/react-dom@18.3.1)(@types/react@18.3.12)(algoliasearch@4.24.0)(next@14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(tailwindcss@3.4.14): + dependencies: + '@radix-ui/react-accordion': 1.2.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-collapsible': 1.1.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-dialog': 1.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-direction': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-navigation-menu': 1.2.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-popover': 1.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-scroll-area': 1.2.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-slot': 1.1.0(@types/react@18.3.12)(react@18.3.1) + '@radix-ui/react-tabs': 1.1.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@tailwindcss/typography': 0.5.15(tailwindcss@3.4.14) + class-variance-authority: 0.7.0 + fumadocs-core: 14.2.0(@oramacloud/client@1.3.18(typescript@5.6.3)(zod@3.23.8))(@types/react@18.3.12)(algoliasearch@4.24.0)(next@14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + next: 14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + next-themes: 0.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + react-medium-image-zoom: 5.2.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + tailwind-merge: 2.5.4 + optionalDependencies: + tailwindcss: 3.4.14 + transitivePeerDependencies: + - '@oramacloud/client' + - '@types/react' + - '@types/react-dom' + - algoliasearch + - supports-color + function-bind@1.1.2: {} function.prototype.name@1.1.6: @@ -10301,6 +10521,31 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) + next@14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + dependencies: + '@next/env': 14.2.4 + '@swc/helpers': 0.5.5 + busboy: 1.6.0 + caniuse-lite: 1.0.30001671 + graceful-fs: 4.2.11 + postcss: 8.4.31 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + styled-jsx: 5.1.1(react@18.3.1) + optionalDependencies: + '@next/swc-darwin-arm64': 14.2.4 + '@next/swc-darwin-x64': 14.2.4 + '@next/swc-linux-arm64-gnu': 14.2.4 + '@next/swc-linux-arm64-musl': 14.2.4 + '@next/swc-linux-x64-gnu': 14.2.4 + '@next/swc-linux-x64-musl': 14.2.4 + '@next/swc-win32-arm64-msvc': 14.2.4 + '@next/swc-win32-ia32-msvc': 14.2.4 + '@next/swc-win32-x64-msvc': 14.2.4 + transitivePeerDependencies: + - '@babel/core' + - babel-plugin-macros + next@15.0.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@next/env': 15.0.1 @@ -11254,6 +11499,11 @@ snapshots: dependencies: inline-style-parser: 0.2.4 + styled-jsx@5.1.1(react@18.3.1): + dependencies: + client-only: 0.0.1 + react: 18.3.1 + styled-jsx@5.1.6(react@18.3.1): dependencies: client-only: 0.0.1 @@ -11384,6 +11634,29 @@ snapshots: tree-kill@1.2.2: {} + trieve-fumadocs-adapter@1.2.3(@oramacloud/client@1.3.18(typescript@5.6.3)(zod@3.23.8))(@types/react-dom@18.3.1)(@types/react@18.3.12)(algoliasearch@4.24.0)(tailwindcss@3.4.14): + dependencies: + fumadocs-core: 14.2.0(@oramacloud/client@1.3.18(typescript@5.6.3)(zod@3.23.8))(@types/react@18.3.12)(algoliasearch@4.24.0)(next@14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + fumadocs-ui: 14.2.0(@oramacloud/client@1.3.18(typescript@5.6.3)(zod@3.23.8))(@types/react-dom@18.3.1)(@types/react@18.3.12)(algoliasearch@4.24.0)(next@14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(tailwindcss@3.4.14) + next: 14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + trieve-ts-sdk: 0.0.14 + transitivePeerDependencies: + - '@babel/core' + - '@opentelemetry/api' + - '@oramacloud/client' + - '@playwright/test' + - '@types/react' + - '@types/react-dom' + - algoliasearch + - babel-plugin-macros + - sass + - supports-color + - tailwindcss + + trieve-ts-sdk@0.0.14: {} + trim-lines@3.0.1: {} trough@2.2.0: {} From fa7469979bf966d111ac99ddb1de8a029c2f7daa Mon Sep 17 00:00:00 2001 From: DNS Date: Fri, 8 Nov 2024 18:15:43 +0000 Subject: [PATCH 2/2] fix: changed import for useTrieveSearch to one from custom adapter --- apps/docs/content/docs/headless/search/trieve.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/docs/content/docs/headless/search/trieve.mdx b/apps/docs/content/docs/headless/search/trieve.mdx index 04789d72..5f74ddeb 100644 --- a/apps/docs/content/docs/headless/search/trieve.mdx +++ b/apps/docs/content/docs/headless/search/trieve.mdx @@ -97,7 +97,7 @@ In addition, the headless search client of Fumadocs can handle state management ```ts import { TrieveSDK } from 'trieve-ts-sdk'; -import { useTrieveSearch } from 'fumadocs-core/search/client'; +import { useTrieveSearch } from 'trieve-fumadocs-adapter/search/trieve'; const client = new TrieveSDK({ apiKey: 'readOnlyApiKey', @@ -153,7 +153,7 @@ On Fumadocs search client, you can add the tag filter like: ```ts import { TrieveSDK } from 'trieve-ts-sdk'; -import { useTrieveSearch } from 'fumadocs-core/search/client'; +import { useTrieveSearch } from 'trieve-fumadocs-adapter/search/trieve'; const client = new TrieveSDK({ apiKey: 'readOnlyApiKey',