Skip to content

Commit cbb34b1

Browse files
author
charlotte
committed
Changed to index name and styling
1 parent 6331c7e commit cbb34b1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

examples/search_example.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,22 @@ const addDataset = async () => {
2323
if (resp.length === 0) {
2424
resp = await meili.createIndex(index)
2525
}
26-
resp = await meili.Index(index.uid).getDocuments()
26+
resp = await meili.getIndex(index.uid).getDocuments()
2727
if (resp.length === 0) {
28-
resp = await meili.Index('movies').addDocuments(dataset)
28+
resp = await meili.getIndex(index.uid).addDocuments(dataset)
2929
await sleep(1000) // This is to give time to MeiliSearch to index the dataset
3030
// If you have no results it means it took more than 1 second to index.
3131
}
3232
}
3333

3434
;(async () => {
3535
await addDataset()
36+
let index = await meili.getIndex('movies')
3637
let resp
37-
resp = await meili
38-
.Index('movies')
39-
.search('Avengers', { limit: 1, attributesToHighlight: 'title' })
38+
resp = await index.search('Avengers', {
39+
limit: 1,
40+
attributesToHighlight: 'title',
41+
})
4042
console.log({ resp })
4143
console.log({ r: resp.hits[0]._formatted })
4244
})()

0 commit comments

Comments
 (0)