File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
src/adapter/search-request-adapter Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -39,18 +39,19 @@ export function SearchResolver(
3939 // Check if specific request is already cached with its associated search response.
4040 if ( cachedResponse ) return cachedResponse
4141
42- const cachedFacets = extractFacets ( searchContext , searchParams )
43-
4442 // Make search request
4543 const searchResponse = await client
4644 . index ( searchContext . indexUid )
4745 . search ( searchContext . query , searchParams )
4846
49- // Add missing facets back into facetDistribution
50- searchResponse . facetDistribution = addMissingFacets (
51- cachedFacets ,
52- searchResponse . facetDistribution
53- )
47+ if ( searchContext . keepZeroFacets ) {
48+ const cachedFacets = extractFacets ( searchContext , searchParams )
49+ // Add missing facets back into facetDistribution
50+ searchResponse . facetDistribution = addMissingFacets (
51+ cachedFacets ,
52+ searchResponse . facetDistribution
53+ )
54+ }
5455
5556 // query can be: empty string, undefined or null
5657 // all of them are falsy's
You can’t perform that action at this time.
0 commit comments