mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-25 03:42:30 +00:00
Filter out short searches less then 2 chars, bigger debounce (#2440)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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 [];
|
||||
|
||||
Reference in New Issue
Block a user