Integrating Blacklight with Alma and an Ex Libris Central Index
In a previous blog post, we learned how to integrate Alma with Blacklight as a discovery layer. There we saw how to utilize Alma for real time availability and fulfillment services for materials which are indexed in our institution’s repository. In order to provide our users with a search of articles and journals we’ll need to integrate with a central index such as Primo Central or Summon Index.
In this example, we will assume the institution has a subscription to Summon Index and would like to expose an article search as an extension to the repository search in a Blacklight instance. The recommended flow to support this use case is illustrated below:
- Electronic packages are managed and activated in Alma
- Electronic holdings are published from Alma to Summon
- Users perform an article search in Blacklight which is executed using the Summon API
- Full text links are resolved using the Alma link resolver, and the user is directed to the full text of the desired article
Export to Summon
Electronic resources are managed in using existing Alma features. Periodically, the Publish Electronic Holdings job is run to export activated packages from Alma to Summon.
Search Summon from Blacklight
To implement an article search, we’ve extended the demo Blacklight/Alma implementation we built in a previous blog post.
Summon API
We’re utilizing the Summon API to perform the search in the Summon Index. The API has a helpful wrapper for Ruby, and that’s what we’ll use in our implementation. To include the wrapper, we’ll add the following to our Gemfile:
gem 'summon'
We also need an access ID and a secret key which we get from Ex Libris support. We add those two values to our application.yml file:
SUMMON_ACCESS_ID: [summon access id] SUMMON_SECRET_KEY: [summon secret key]
Articles Controller
We then add a new controller called ArticlesController and a matching route in the routes configuration. To access the controller, we create a new catalog menu partial view as a part of the search header partial. This adds a tabbed menu to the search results, allowing a user to switch the current search term to an articles search.
When the controller is called with a search query, we need to create a Summon service object and perform a search with the provided search term:
service = Summon::Service.new( :access_id => ENV['SUMMON_ACCESS_ID'], :secret_key => ENV['SUMMON_SECRET_KEY'] ) search = service.search({ "s.fvf" => "ContentType,Journal Article,f", "s.q" => params['q'], "s.ps" => PAGE_SIZE, "s.pn" => params['page'] })
Then we extend the returned array of Summon documents with methods that can be used with the Kaminari pagination gem.
@docs = Kaminari.paginate_array( search.documents, offset: (params['page'].to_i-1)*PAGE_SIZE, limit: PAGE_SIZE, total_count: search.record_count )
Once that’s done, we’re ready to pass the docs array to the articles index view to display our results.
Articles Views
We try to leverage as many of the Blacklight views as possible, copying several of the out-of-the-box catalog partials into the articles view folder. The main presentation logic is done in the document list partial. There we display several of the fields available on the Document object.
The end result is a page which looks as similar as possible to the repository book search.
Full text links
In order to create the full text link, we utilize the Alma link resolver. That allows us to leverage all of the configuration and statistics maintained in Alma while providing a smooth user experience for our patrons. We can make use of the OpenUrl standard querystring which the Summon API returns and append it to the Alma link resolver endpoint.
<a href="<%=openurl_base+doc.open_url%>" target="_blank">Fulltext</a>
Summary
With the integrations and open standards implemented in Alma and Summon, we can provide a full discovery experience for our end users, including searches in our local repository and central articles index.
The code for this blog post is available in this Github repository.