1

I've built a custom component to handle client data, along with a plugin for the Smart Search component to find, index, and include them in searches. Thus far, everything works; the indexer sees my component, it's indexing the relevant content I'm asking it to, and search results include relevant client data.

The issue I'm having is that if/when a client's information is changed or a new client is added, the index does not update to include these changes.

Surely I've just missed a vital component/function somewhere, but despite digging through what documentation I can find and the already existing Joomla components/indexers, I can't find whatever it is that I'm missing for this to function.

Note: This was originally posted on a different stack exchange, and transferred over here

1 Answer 1

2

After much testing and digging through various files, I have found the answer.

By default, Joomla has configured plugins that hook onto the various events triggered throughout the save process. From there the plugins themselves trigger the finder events that update indexes.

The solution, without making a plugin similar to what Joomla does, was to add this code after a model/table/etc successfully performed a save:

Joomla\CMS\Plugin\PluginHelper::importPlugin('finder');
Joomla\CMS\Factory::getApplication()->triggerEvent('onFinderAfterSave', [$context, $row, $isNew]);

The various variables being sent as a part of the events are explained in adequate detail in any of the plugins that are included in Joomla.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.