diff --git a/packages/gitbook/src/components/Search/SearchResults.tsx b/packages/gitbook/src/components/Search/SearchResults.tsx index 4f6b8b440..4f8b2ffb8 100644 --- a/packages/gitbook/src/components/Search/SearchResults.tsx +++ b/packages/gitbook/src/components/Search/SearchResults.tsx @@ -98,7 +98,7 @@ export const SearchResults = React.forwardRef(function SearchResults( : searchSpaceContent(spaceId, revisionId, query)); setResults(withAsk ? withQuestionResult(fetchedResults, query) : fetchedResults); - }, 250); + }, 350); return () => { if (debounceTimeout.current) { diff --git a/packages/gitbook/src/components/Search/server-actions.tsx b/packages/gitbook/src/components/Search/server-actions.tsx index c692cf92f..dfde57992 100644 --- a/packages/gitbook/src/components/Search/server-actions.tsx +++ b/packages/gitbook/src/components/Search/server-actions.tsx @@ -60,6 +60,10 @@ export async function searchSiteContent(args: { const { siteSpaceIds, query, cacheBust } = args; const pointer = getContentPointer(); + if (query.length <= 1) { + return []; + } + if (siteSpaceIds?.length === 0) { // if we have no siteSpaces to search in then we won't find anything. skip the call. return [];