File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
adapter/search-request-adapter Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -39,18 +39,19 @@ export function SearchResolver(
39
39
// Check if specific request is already cached with its associated search response.
40
40
if ( cachedResponse ) return cachedResponse
41
41
42
- const cachedFacets = extractFacets ( searchContext , searchParams )
43
-
44
42
// Make search request
45
43
const searchResponse = await client
46
44
. index ( searchContext . indexUid )
47
45
. search ( searchContext . query , searchParams )
48
46
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
+ }
54
55
55
56
// query can be: empty string, undefined or null
56
57
// all of them are falsy's
Original file line number Diff line number Diff line change @@ -77,6 +77,8 @@ export function instantMeiliSearch(
77
77
searchRequest ,
78
78
instantMeiliSearchOptions ,
79
79
defaultFacetDistribution
80
+ )
81
+
80
82
const adaptedSearchRequest = adaptSearchParams ( searchContext )
81
83
82
84
You can’t perform that action at this time.
0 commit comments