- October 7, 2019 at 3:17 am #24224
The sites products are being uploaded via an API and while new products are being added they are not causing the site to re-index, I have to delete the current index and install a new one for it to work.
Is there a way that I can set up a CRON to delete then re index the site at certain times? Without Deleting the index first it doesn’t add the new items.
Can you think of another way around this?October 7, 2019 at 2:05 pm #24231
Ernest MarcinkoKeymasterOctober 8, 2019 at 2:39 am #24239
Yes I have tried that, but it is like it doesn’t recognise there are new items so it doesn’t add the new products.October 8, 2019 at 2:19 pm #24250
That sounds very strange. The cron process runs periodically, but it won’t index everything all at once to save resources. If you add for example over 100 items at once, it may take a few executions to index.
You can trigger the deletion of the index table, but then it has to be indexed again, but then again it takes multiple requests to index everything via CRON depedning on the database size. You will have basically an empty index maybe for a couple of hours or even more.
I would rather recommend executing the save_post action hook after each and every item when it is imported. That will automatically trigger everything that is attached to that hook, including the indexing. It might be much easier to add this to the API endpoint, as this should be already executed by default.Best,
If you like my products, don't forget to rate them on codecanyon :)
You must be logged in to reply to this topic.