You are right, it is not supported out of the box. We thought and talked about it, and it is actually more complicated than it sounds, if you consider campaigns and promotions can be scheduled/expired. Using scheduled job to reindex is not a bad idea, but you can use the existing one, no?
We will keep that problem in mind, maybe some day we will be able to solve it nicely.
Yes, that will do the job, but I was thinking about something more specific, that would allow to reindex only affected products instead of a whole catalog.
Thank you for prompt reply.
It's quite an annoying issue indeed. But since promotions are IContent too, you can try with the approach of creating an IInitializableModule that makes use of IContentEvents and it's SavingContent event.
Then checking if the content being saved is a promotion that has lists of references to products/variants.
Then finally passing those references to the IContentIndexer.IndexFrom-method.
One hurdle to get past is when removing products from a campaign, these should get indexed too I presume. I haven't come up with something for this case yet. Maybe loading the content from the db (IContentRepository) during the SavingContent-event to get them from there?
Hopefully this can give you some inspiration on things to try, but as Quan said it isn't super simple. :P
Thanks for sharing your thoughts. I decided to stick to a whole catalog reindexing so far. May be will replace It with some elegant solution in future. :)
Hi.
I faced an issue that products/variants included into promotion are not getting re-indexed on promotion change. Is this feature not implemented at all, or I'm doing something wrong? Find search is in use if It's matter.
If this functionality is not available OOTB, if there any way to attach to promotion/campaign lifecycle to get events about promotion creation/update/removal/expiration? Because right now, the only solution I came up with is to create a job that will reindex such products nightly, but obviously It looks like a bad idea.
Thank you.