Skip to content

Commit 197de1d

Browse files
committed
Add placeholderSearch option
1 parent 3b0b2ba commit 197de1d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ export default function instantMeiliSearch(hostUrl, apiKey, options = {}) {
77
hitsPerPage: options.hitsPerPage || 10,
88
limitPerRequest: options.limitPerRequest || 50,
99
attributesToHighlight: ['*'],
10+
placeholderSearch: options.placeholderSearch !== false, // true by default
1011

1112
transformToMeiliSearchParams: function (params) {
1213
const searchInput = {
13-
q: params.query === '' ? null : params.query,
14+
q: this.placeholderSearch && params.query === '' ? null : params.query,
1415
facetsDistribution: params.facets.length ? params.facets : undefined,
1516
facetFilters: params.facetFilters,
1617
attributesToHighlight: this.attributesToHighlight,

0 commit comments

Comments
 (0)