Force Reindex on Cron

This topic contains 3 replies, has 2 voices, and was last updated by

 
Keymaster
2 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #24224

    Participant

    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?

    #24231

    Hi,

    Have you tried to enable the built in CRON option to force the indexing of new items? If the items are being added (and not existing updated), then it should do the trick.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #24239

    Participant

    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.

    #24250

    Hi,

    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,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.