my assistant and I created a plugin that implements the Display filter for some Metadata elements. While a complete description of our plugin (which is still in development as I am typing this) would go beyond the scope of this forum post, let's just say for now that we use the Display filter to change and enrich the element's output a great deal.
As the displayed element now differs from the database representation and contains more information than before, we would like to modify its footprint in Omeka's in-site search. We figured that it all boils down to what's stored in the omeka_search_texts database table – which is filled by the item's addSearchText() calls.
However, we couldn't figure out a proper way to carry this out. We added our own addSearchText() calls to the hookAfterSaveItem() – like this (shorted code):
$itemId = intval($args["record"]["id"]);
$item = get_record_by_id('Item', $itemId);
$item->addSearchText("... our enriched search content …");
… and this kind of worked – until we had a second plugin trying to do the exact same thing: This lead to the situation that only the plugin which's hookAfterSaveItem() was called last was able to add search text, purging the search text that the first plugin had added just a moment before.
Even worse: If a different piece of code use something like (shortened)
… none of our hookAfterSaveItem() methods were called – leading to the situation that none of our plugins was able to add search text.
What else can we do? We combed through Omeka's core code, trying to figure out how element texts and tag texts are added to the search text. We figured that mixins might be the right way to go – question is: Can we implement a mixing that adds search text to the existing record type "Item"?
Thank you very much for any pointer where to go from here.