Skip to content

Commit 1af96f5

Browse files
bors[bot]bidoubiwa
andauthored
Merge #424
424: Remove api key from mandatory config r=bidoubiwa a=bidoubiwa Co-authored-by: Charlotte Vermandel <[email protected]> Co-authored-by: cvermand <[email protected]>
2 parents e29cac7 + 7e99019 commit 1af96f5

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ If you already have your own scraper but you still want to use MeiliSearch and `
9191
</html>
9292
```
9393

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>
9595
`indexUid` is the index identifier in your MeiliSearch instance in which your website content is stored.<br>
9696
`inputSelector` is the `id` attribute of the HTML search input tag.
9797

src/lib/DocsSearchBar.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class DocsSearchBar {
180180
* @returns {void}
181181
*/
182182
static checkArguments(args) {
183-
if (!args.apiKey || !args.indexUid || !args.hostUrl) {
183+
if (!args.inputSelector || !args.indexUid || !args.hostUrl) {
184184
throw new Error(usage)
185185
}
186186

@@ -302,7 +302,6 @@ class DocsSearchBar {
302302
groupedHits[level] = flattenedHits
303303
})
304304
groupedHits = utils.flattenAndFlagFirst(groupedHits, 'isCategoryHeader')
305-
306305
// Translate hits into smaller objects to be send to the template
307306
return groupedHits.map((hit) => {
308307
const url = DocsSearchBar.formatURL(hit)

src/lib/__tests__/DocsSearchBar-test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,15 @@ describe('DocsSearchBar', () => {
245245
const options = {
246246
apiKey: 'apiKey',
247247
indexUid: 'indexUID',
248+
inputSelector: '#',
248249
}
249250

250251
// When
251252
expect(() => {
252253
checkArguments(options)
253254
}).toThrow(/^Usage:/)
254255
})
255-
it('should throw an error if no apiKey defined', () => {
256+
it('should throw an error if no inputSelector defined', () => {
256257
// Given
257258
const options = {
258259
hostUrl: 'test.com',
@@ -268,7 +269,7 @@ describe('DocsSearchBar', () => {
268269
// Given
269270
const options = {
270271
hostUrl: 'test.com',
271-
apiKey: 'apiKey',
272+
inputSelector: '#',
272273
}
273274

274275
// When
@@ -282,6 +283,7 @@ describe('DocsSearchBar', () => {
282283
hostUrl: 'test.com',
283284
apiKey: 'apiKey',
284285
indexUid: 'indexUID',
286+
inputSelector: '#',
285287
}
286288
sinon.stub(DocsSearchBar, 'getInputFromSelector').returns(false)
287289

0 commit comments

Comments
 (0)