File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff 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} ) ( )
You can’t perform that action at this time.
0 commit comments