File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ If you already have your own scraper but you still want to use MeiliSearch and `
91
91
</html >
92
92
```
93
93
94
- The ` hostUrl ` and the ` apiKey ` fields are the credentials of your MeiliSearch instance.<br >
94
+ The ` hostUrl ` and the ` apiKey ` ( _ optional _ ) fields are the credentials of your MeiliSearch instance.<br >
95
95
` indexUid ` is the index identifier in your MeiliSearch instance in which your website content is stored.<br >
96
96
` inputSelector ` is the ` id ` attribute of the HTML search input tag.
97
97
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ class DocsSearchBar {
180
180
* @returns {void }
181
181
*/
182
182
static checkArguments ( args ) {
183
- if ( ! args . apiKey || ! args . indexUid || ! args . hostUrl ) {
183
+ if ( ! args . inputSelector || ! args . indexUid || ! args . hostUrl ) {
184
184
throw new Error ( usage )
185
185
}
186
186
@@ -302,7 +302,6 @@ class DocsSearchBar {
302
302
groupedHits [ level ] = flattenedHits
303
303
} )
304
304
groupedHits = utils . flattenAndFlagFirst ( groupedHits , 'isCategoryHeader' )
305
-
306
305
// Translate hits into smaller objects to be send to the template
307
306
return groupedHits . map ( ( hit ) => {
308
307
const url = DocsSearchBar . formatURL ( hit )
Original file line number Diff line number Diff line change @@ -245,14 +245,15 @@ describe('DocsSearchBar', () => {
245
245
const options = {
246
246
apiKey : 'apiKey' ,
247
247
indexUid : 'indexUID' ,
248
+ inputSelector : '#' ,
248
249
}
249
250
250
251
// When
251
252
expect ( ( ) => {
252
253
checkArguments ( options )
253
254
} ) . toThrow ( / ^ U s a g e : / )
254
255
} )
255
- it ( 'should throw an error if no apiKey defined' , ( ) => {
256
+ it ( 'should throw an error if no inputSelector defined' , ( ) => {
256
257
// Given
257
258
const options = {
258
259
hostUrl : 'test.com' ,
@@ -268,7 +269,7 @@ describe('DocsSearchBar', () => {
268
269
// Given
269
270
const options = {
270
271
hostUrl : 'test.com' ,
271
- apiKey : 'apiKey ' ,
272
+ inputSelector : '# ' ,
272
273
}
273
274
274
275
// When
@@ -282,6 +283,7 @@ describe('DocsSearchBar', () => {
282
283
hostUrl : 'test.com' ,
283
284
apiKey : 'apiKey' ,
284
285
indexUid : 'indexUID' ,
286
+ inputSelector : '#' ,
285
287
}
286
288
sinon . stub ( DocsSearchBar , 'getInputFromSelector' ) . returns ( false )
287
289
You can’t perform that action at this time.
0 commit comments