When someone clicks an item from the Solr search results, Mirador opens with the search term already run against the item's IIIF content search service, so matches are highlighted with no extra JavaScript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Paul Pound 938ee28b84 first commit 1 week ago
README.md first commit 1 week ago
composer.json first commit 1 week ago
mirador_search_highlight.info.yml first commit 1 week ago
mirador_search_highlight.module first commit 1 week ago

README.md

Mirador search highlight

When someone clicks an item from the Solr search results, Mirador opens with the search term already run against the item's IIIF content search service, so matches are highlighted with no extra JavaScript.

How it works

  1. hook_views_pre_render() appends ?search_api_fulltext=<term> to the "Link this field to its item" links in the solr_search_content view.
  2. hook_preprocess_mirador() reads that parameter and sets windows[0].defaultSearchQuery on the viewer's Mirador config.

The manifest must advertise a search service (search_endpoint in the iiif_manifest view) for Mirador to run the search.

Configuration

Edit the constants at the top of mirador_search_highlight.module to change the query parameter or the views whose links carry the term.

Only fields using Search API's "Link this field to its item" option get the term. Fields linked another way (for example an image formatter linking to content) are left alone.