I’m working on a project where we are using Omeka for displaying exhibits only. Items / files and their associated metadata are all being imported from a CONTENTdm site, and I’ve customized the theme so the exhibit images link to CONTENTdm instead of to Omeka. I’ve also created custom exhibit layouts that automatically generate captions from the metadata.
I’ve set it to search within exhibits, exhibit pages, and simple pages only, rather than duplicate direct access to the items and files on our CONTENTdm site. However, I’ve just realized that the automatically generated captions are not searched, so items in exhibits don’t come up in the search unless they are explicitly mentioned elsewhere in the exhibit text.
Can anyone help me figure out a workaround for this issue, other than having to manually enter the captions for hundreds of items? The whole point was to save time on that since the metadata are already there. Is there any way to force the generated captions to show up in the exhibit texts table to get searched? OR conversely, any way to search the items but direct the search results to the related exhibit page instead of the item page?
That’ll be a little tricky, but I think doable via a plugin. Since it is possible for items to be on multiple exhibit pages, I’d aim away from your second idea of directing item search results to the related exhibit page. It might be safe to assume items aren’t reused now, but I’d hesitate to try to put in a solution that depends on that assumption.
Instead, I’d aim for a plugin that rewrites the captions for the attachments as they are stored in the database, rather having that happen within the layout – essentially moving your automatically generated captions to be stored in the database.
The plugin would use the before_save_<model> hook on the
ExhibitBlockAttachment model to set its caption, using whatever code you have now to create it.
So, basically it would look like:
public function hookBeforeSaveExhibitBlockAttachment($args)
$attachment = $args['record'];
$item = $attachment->getItem();
$caption = '';
// apply your magic to generate the caption with the $item object
$attachment->caption = $caption;
The weakness here is that if anyone wants to write their own caption, it will be overridden by the plugin with this code. But it sounds like that’s already pretty well baked-in.
Once a plugin that does that is up and running and working, you’d have to go through all the exhibit pages and save them to get the data into the search system. It might also be worth removing the generated captions from your custom layouts, just so there isn’t code doing the same thing in two different places.
This topic was automatically closed after 250 days. New replies are no longer allowed.