Where I can find any tutorial or instructions to build a plugin which handles "onPrepareFinderContent" ?

I've added some extra fields to com_content articles and I would like them to be indexed by the Finder engine.

I'm looking for a way to add a new element to the FinderIndexerResult object that is going to be indexed.

I've seen this line of code in plugins/finder/content/content.php at line 311:

// Get content extras.

The FinderIndexerHelper::getContentExtras function accepts the FinderIndexerResult object which is going to be indexed and then trigger an "onPrepareFinderContent" event, which (I suppose) allows 3dparty plugin to add or modify the content that is going to be indexed.

Some of you has any experience on this or can point me to some good tutorial/documentation?

2 Answers 2


I've done a number of extra fields in com_content. I think because the method used to do this is pretty custom as you specify your own table and such, there isn't a really repeatable method which you can use to get this information merged into com_finder.

My suggestion to you would be to fork the content indexer plugin for finder and then set it up to call out to the fields you've added.

The first thing you'd do is modify the getListQuery in the finder to join to your extra fields table:


Then after that, depending on how you save your extra fields (JRegistry object?) you'd just have to tell finder to look at the additional fields you've got in the query:

I have a feeling you'd end up adding it as some meta information: https://github.com/joomla/joomla-cms/blob/staging/plugins/finder/content/content.php#L286

Hope this helps


Working for a SobiPro-Smart Search plugin, we've added extra fields in getItems, processing items to be indexed as FinderIndexerResult, and later, in index for each item, adding Instructions of each extra field:

protected function index(FinderIndexerResult $item, $format = 'html')

            $fields = $this->_fields[$item->section];

            foreach ($fields as $f)
                $nid = $f->get('nid');

                if (isset($item->$nid))
                    $item->addInstruction(FinderIndexer::TEXT_CONTEXT, $nid);
  • Thank you, your answer pinted me to the right direction ;) I eventually wrote a finder plugin (extends JPlugin) which implements the onPrepareFinderContent event (fired by FinderIndexerHelper::getContentExtras). I then added instructions as you showed and the corresponding extra fields: public function onPrepareFinderContent(FinderIndexerResult &$row) { .... $row->addInstruction(FinderIndexer::TEXT_CONTEXT, $field->id); $row->setElement($field->id, $field->value); .... }
    – Cristiano
    Commented May 5, 2014 at 8:56
  • Excellent! Do you have to mark the question as solved?
    – Anibal
    Commented May 5, 2014 at 12:29
  • @Cristiano : Did you ever resolve this? There's no accepted answer, and I'm faced with the same problem - did you ever figure out how to use these routines?
    – GDP
    Commented Jan 25, 2016 at 16:35
  • Even if the answer is not accepted by the original author... that's how it works on my smart search plugin ;-)
    – Anibal
    Commented Jan 27, 2016 at 8:57

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.