From 086ffac2cb284ef85242eeee128148da9171d245 Mon Sep 17 00:00:00 2001 From: Steeve Pastorelli Date: Wed, 19 Feb 2025 16:30:47 +0100 Subject: [PATCH 1/2] Remove ununsed search api lib methods --- packages/gitbook/src/lib/api.ts | 49 --------------------------------- 1 file changed, 49 deletions(-) diff --git a/packages/gitbook/src/lib/api.ts b/packages/gitbook/src/lib/api.ts index a610c31b05..04f500601c 100644 --- a/packages/gitbook/src/lib/api.ts +++ b/packages/gitbook/src/lib/api.ts @@ -1066,55 +1066,6 @@ export async function getSpaceContentData( }; } -/** - * Search content in a space. - */ -export const searchSpaceContent = cache({ - name: 'api.searchSpaceContent', - tag: (spaceId) => getAPICacheTag({ tag: 'space', space: spaceId }), - getKeySuffix: getAPIContextId, - get: async ( - spaceId: string, - /** The revision ID is used as a cache bust key, to avoid revalidating lot of cache entries by tags */ - revisionId: string, - query: string, - options: CacheFunctionOptions, - ) => { - const apiCtx = await api(); - const response = await apiCtx.client.spaces.searchSpaceContent( - spaceId, - { query }, - { - ...noCacheFetchOptions, - signal: options.signal, - }, - ); - return cacheResponse(response); - }, -}); - -/** - * Search content accross all spaces in a parent (site or collection). - */ -export const searchParentContent = cache({ - name: 'api.searchParentContent', - tag: (spaceId) => getAPICacheTag({ tag: 'space', space: spaceId }), - getKeySuffix: getAPIContextId, - get: async (parentId: string, query: string, options: CacheFunctionOptions) => { - const apiCtx = await api(); - const response = await apiCtx.client.search.searchContent( - { query }, - { - ...noCacheFetchOptions, - signal: options.signal, - }, - ); - return cacheResponse(response, { - ttl: 60 * 60, - }); - }, -}); - /** * Search content in a Site or specific SiteSpaces. */ From 58de921d312ca80287f2815452c858d9589aedfd Mon Sep 17 00:00:00 2001 From: Steeve Pastorelli Date: Wed, 19 Feb 2025 16:33:50 +0100 Subject: [PATCH 2/2] Add changeset --- .changeset/beige-spoons-grab.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/beige-spoons-grab.md diff --git a/.changeset/beige-spoons-grab.md b/.changeset/beige-spoons-grab.md new file mode 100644 index 0000000000..5deb2c742f --- /dev/null +++ b/.changeset/beige-spoons-grab.md @@ -0,0 +1,5 @@ +--- +'gitbook': patch +--- + +Remove unused search api method from gitbook/api/lib