You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clémentine Urquizar - curqui edited this page Jan 27, 2022
·
6 revisions
Some Meilisearch operations are asynchronous, e.g. the document addition or the settings update. They will be put in a queue and will be executed in turn (asynchronously).
⚠️ Don't use this method if you process an operation on a large batch of documents. It would stop your code execution for too long.
Example
With wait_for_task:
puts'Adding Le Petit Prince...'response=index.add_document(id: 1,title: 'Le Petit Prince')task_uid=response['uid']wait_for_task(task_uid)puts'Addition done!'
Adding Le Petit Prince...
[Meilisearch has finished adding the document]
Addition done!
Without wait_for_task:
puts'Adding Le Petit Prince...'response=index.add_document(id: 1,title: 'Le Petit Prince')puts'Addition done!'
Adding Le Petit Prince...
Addition done!
[Meilisearch has now finished adding the document, but not before the "Addition done!" was written]
Bang (!) methods
This library provides the following synchronous methods:
add_documents!
update_documents!
delete_documents!
delete_document!
delete_all_documents!
These methods stop your code execution until the asynchronous task has been processed by Meilisearch.