From 07206f1c65e100d12c6f49e47c1025388f402875 Mon Sep 17 00:00:00 2001 From: Tommaso Allevi Date: Fri, 2 Aug 2024 18:06:33 +0200 Subject: [PATCH] Improve REST Api documentation (#758) --- packages/docs/.gitignore | 2 ++ .../custom-integrations/rest-apis.mdx | 16 +++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/docs/.gitignore b/packages/docs/.gitignore index 6240da8b1..7fb2657ff 100644 --- a/packages/docs/.gitignore +++ b/packages/docs/.gitignore @@ -19,3 +19,5 @@ pnpm-debug.log* # macOS-specific files .DS_Store + +.next \ No newline at end of file diff --git a/packages/docs/src/content/docs/cloud/data-sources/custom-integrations/rest-apis.mdx b/packages/docs/src/content/docs/cloud/data-sources/custom-integrations/rest-apis.mdx index 4dfed9ccc..6ae8540ec 100644 --- a/packages/docs/src/content/docs/cloud/data-sources/custom-integrations/rest-apis.mdx +++ b/packages/docs/src/content/docs/cloud/data-sources/custom-integrations/rest-apis.mdx @@ -122,7 +122,7 @@ You can use the **snapshot** API to bulk update the live index: ## Updating, removing, inserting elements in a live index -While the **snapshot** API is convenient for replacing a live index with a new one, there may be instances where you only want to update one or more documents, or perhaps insert and delete others. +While the **snapshot** API is convenient for replacing a live index with a new one, there may be instances where you only want to change some documents, inserting, updating, and deleting ones. This is where the **notify** API becomes really convenient. @@ -193,9 +193,9 @@ you can use the **notify** API to put that operation in queue for the next deplo -as you can see, you'll need to pass an array of objects to an `upsert` operation (will do that based on the `id` field). If Orama find that document, it will update it, otherwise it will insert a new one. +As you can see, you'll need to pass an array of objects to an `upsert` operation (which will do that based on the `id` field). If Orama finds that document, it will update it; otherwise, it will insert a new one. -You can always remove an existing document by using the `remove` operation. For example, this is how you can remove the document with id `"2"`: +You can also remove an existing document using the `remove` operation. For example, this is how you can remove the document with id `"2"`: @@ -302,7 +302,7 @@ This will trigger a new deployment and will make the new index available worldwi ## Clearing the index on next deployment -Sometimes, you may want to re-insert all the documents in the index, and to do that, you will first need to tell Orama to clear the index on the next deployment. +Sometimes, you may want to re-insert all the documents in the index and to do that, you will first need to tell Orama to clear the index for the next deployment. You can do that by using the `clear` API, or by creating an empty snapshot: @@ -351,7 +351,7 @@ You can do that by using the `clear` API, or by creating an empty snapshot: -This will clear the index on the next deployment, and you can then insert a new snapshot or a number of operations to update the index. This ensures that old data is not present in the index anymore. +This will clear the index, making the next deployment start from empty status. You can then notify some operations to update the index. This ensures that old data is not present in the index anymore. ## Check if there are pending operations @@ -369,8 +369,7 @@ If you lost track of the operatiosn you ran via the SDK or APIs, you can always const myIndex = oramaCloudManager.index('my-index-id') const hasPendingOperations = await myIndex.hasPendingOperations() - console.log(hasPendingOperations) - // true or false + console.log(hasPendingOperations) // true or false ``` @@ -389,8 +388,7 @@ If you lost track of the operatiosn you ran via the SDK or APIs, you can always let hasPendingOperations = await try indexManager.hasPendingOperations() - print(hasPendingOperations) - // true or false + print(hasPendingOperations) // true or false ```