Hi @saumya010
Based on this part, “There has been a critical error on this website”, it sounds like you’re experiencing a PHP error, so it’d be worth checking your hosting error logs for instances of “Fatal error” lines, especially around timestamps for previous indexing attempts.
Hi Michael, thank you for your response. However, there is no error in the logs related to this.
It looks more like a timeout situation, anything that I could do to avoid it?
We have some docs on how to hopefully avoid timeout issues at https://github.com/WebDevStudios/wp-search-with-algolia/wiki/Timeouts
I also know we have WP_CLI integration that could potentially help, but also has batch support https://github.com/WebDevStudios/wp-search-with-algolia/wiki/WP-CLI though batching could be a bit more manual, which isn’t ideal if bulk processing is a routine need
I have tried these with various options but I don’t think the plugin can handle the large amount of data, hence failing to index every time.
Is there any other way to ensure this works correctly?
It’s definely capable overall to handle as even the UI indexing is going in paged chunks at a time over AJAX. As a test, I have a local install that has WooCommerce and 65k products that were autogenerated. I have reindexing of them going on at the moment and it’s up to 11,200 records and counting.
The question with timeouts includes what all else may be going on on the sever at the same time, what may cause it to fail. Potential memory issues, fatal errors triggered somehow elsewhere, or perhaps something even with specific items attempted to be indexed. For that last one, an example would be potentially the content resulting in invalid JSON somehow.
The questions are what, if any of those, and why. Sadly, I don’t have specific answers in this specific situation.
Hey Saumya,
I had the same problem earlier today and it was actually a PHP Fatal Error in a third-party plugin. And my server was not adding the error the PHP error log either. This plugin was trying to use a not always countable/array variable in a count() method, which was resulting in:
PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array
So I added a is_array() before it to prevent the error from happening and, then, I could index all the content (+10k posts and pages) properly.
To learn the error I was getting, I first activated the WP debug in wp-config.php with:
define( 'WP_DEBUG', true );
Then, I tried to index the content through the plugin UI one more time to intentionally trigger the error and, once it was triggered, I opened the file wp-content/debug.log, which showed me the file/line where the Fatal Error was happening.
Considering you are always getting the error in 48%, it seems the code stops always at the same moment. So I wouldn’t think it is a timeout issue. To me a page or post to be indexed is triggering a condition that is causing an error somewhere in a plugin or in the theme. Good luck.
@munizleo with your is_array edit, were you altering the Algolia plugin? or the other 3rd party one?
Hi Leo, thank you for your insights. I have already tried this and still there are no logs and errors.
I agree with Michael on this, its more of a server issue with AJAX timing out after a certain point which we are yet to pinpoint and figure out.
Did you ever get this resolved @saumya010