Epinova / Epinova.Elasticsearch

A search-plugin for Episerver CMS and Commerce
MIT License
29 stars 20 forks source link

Feature Request: Ability to disable index on publish #202

Open AThraen opened 1 year ago

AThraen commented 1 year ago

In some cases, for example when you have a scheduled job that will regularly update a lot of content it will slow down the process tremendously if an index method is called for each content item. It would be very useful if there was a way to disable (at least temporarily) when doing major updates, and then re-enable after.

otanum commented 1 year ago

Normally indexing is way faster than saving content.

Is it possible to do the opposite of the Initializer in your scheduled job? https://github.com/Epinova/Epinova.Elasticsearch/blob/07cbd4337597ded490c1a28499636ba8cc72e971/src/Epinova.ElasticSearch.Core.EPiServer/Initialization/IndexingInitializer.cs

First remove events and then readd them when job is finished.

AThraen commented 1 year ago

I was considering doing exactly that, but since the event handlers (IndexingEvents) are marked internal it's not straight forward. A simple solution could be to mark it public - then I'll give it a try :-)

A scheduled job that runs a few times a day and syncs products with salesforce used to take 10 minutes, now takes 50 minutes. Only change is the addition of the commerce integration. For reasons beyond my control the sched. job deletes and then recreates a lot of content - which probably causes both a lot of individual deletes and a lot of individual index calls to happen.