Is there a way to delay indexing?

I have a decoupled application. Backend is running on Laravel and frontend runs on Gatsbyjs with Algolia instantsearch.

When I update/add models on my backend, Algolia indexing happens fast. Problem is that my frontend takes time to build (approx; 10-20 minutes).

I don’t want to expose new indexed data to frontend before this one build updated/new model’s pages.

How can I delay Algolia indexing?

Hi there!

Instead of delaying the indexing of Algolia, I would recommend indexing to a temporary index, and replace your production index with the temporary one once your Gatsby website has built and deployed.

If you’re using our Laravel integration, it exposes the PHP client for you to use directly.

You can use the moveIndex method (which counts for a single operation), and run it directly in your CI once you know that the website has built and was properly deployed. This also avoid putting your application in a weird state if the CI fails.

If you’re using incremental updates (using partialUpdateObjects, for example) instead of reindexing everything all the time, you can first copy the production index with copyIndex (which counts for a single operation) as your temporary index, do your partial updates here, and finally move it.



I believe you can delay indexing by debouncing. This can be set in the searchbox.
Here are the docs for Instantsearch.js.

We use React instantsearch which have these docs for debouncing:

We have implemented search only after 3 keys are typed into searchbox.

Thanks for jumping in here @christina.hastenrath. I think @wassimdotis is looking to delay adding new content to their index rather than delay searching for that new content, which I believe the resources you shared point to. Good to know about though!