diff --git a/components/search-form.tsx b/components/search-form.tsx index 2001fa30f..8b39a1dfa 100644 --- a/components/search-form.tsx +++ b/components/search-form.tsx @@ -35,6 +35,7 @@ export function SearchForm({ sortSettings, autoSearch, initialValue, + checkDocSize, }: { itemName: string; onSubmitKeywords: (keywords: string, filters?: any, sort_by?: string) => void; @@ -46,6 +47,7 @@ export function SearchForm({ filters?: {}; sort?: string; }; + checkDocSize: boolean; }) { const defaultSort = sortSettings?.length ? sortSettings[0].value : ""; const [keywords, setKeywords] = useState(""); @@ -139,6 +141,7 @@ export function SearchForm({ + {filterItems && Object.keys(filterItems).length ? ( <> Filter @@ -161,17 +164,29 @@ export function SearchForm({ > {buckets.map((bucket: any, bIdx: number) => { - return ( - bucket.doc_count > 0 && - bucket.key && ( + if (bucket.key) { + if (checkDocSize && bucket.doc_count > 0) { + return ( + + ); + } + + // FAQ page doesn't check the doc_count + return ( - ) - ); + ); + } + return null; })} @@ -180,6 +195,7 @@ export function SearchForm({ ) : null} + {sortSettings?.length ? (
diff --git a/lib/hooks/use-search.ts b/lib/hooks/use-search.ts index a73c273c4..9c1c87d9a 100644 --- a/lib/hooks/use-search.ts +++ b/lib/hooks/use-search.ts @@ -27,6 +27,7 @@ export function useSearch( ...sortSettings, }, }; + if (aggregationSettings?.length) { configuration.aggregations = aggregationSettings.reduce( (aggregations: any, cur) => { diff --git a/pages/faq.tsx b/pages/faq.tsx index 7489c3f9f..cea9371bc 100644 --- a/pages/faq.tsx +++ b/pages/faq.tsx @@ -64,6 +64,7 @@ export default function Faqs(props: FaqsProps) { />