wilr / silverstripe-algolia

Handles indexing Silverstripe Pages into Algolia and providing results
BSD 3-Clause "New" or "Revised" License
13 stars 15 forks source link

AlgoliaReindex task doesn't remove old records from the index #55

Closed zaidaldabbagh closed 1 year ago

zaidaldabbagh commented 1 year ago

Current Behaviour

The AlgoliaReindex task doesn't seem to remove existing records that no longer exists in SilverStripe ... For example, let's say Content Item X was removed, executing the AlgoliaReindex task doesn't seem to remove it from the Index even with the forceAll=1 being passed. This is undesirable, as it means Algolia's InstantSearch will still present this no longer existing item in the hits.

The only solution would be to clear out the full index, and to do a full re-index, which unfortunately is quiet slow at the moment, and takes about 10 minutes, which would be distributive for users, as we have a cron job that re-indexes records every few hours throughout the day.

Expected Behaviour

Ideally, when running the AlogoliaReindex task, old records that no longer exist in SilverStripe are removed from the index, so it no longer appears in the InstantSearch hits.

wilr commented 1 year ago

Hi @zaidaldabbagh You are correct, forceAll forces all records in Silverstripe to be re-indexed. It does not clear all existing ones. I've added a clearAll flag now.

zaidaldabbagh commented 1 year ago

@wilr do you have a new published version that we can install?

wilr commented 1 year ago

You can always use dev-main#commit for testing the change instantly. I've tagged 1.4.13 as well.