BlacklightHighlight: Blacklight plugin that exposes Solr’s highlight field component

Description

The BlacklightHighlight Field plugin provides basic support for the Solr Highlight component, which provides search term highlighting in text fields.

This plugin overrides low-level methods from RSolr::Doc to provide easy access to the highlighting results. This means, however, that if you have a highlighted field, it may be difficult to access the un-highlighted version directly. It also provides a very basic configuration out-of-the-box, with the expectation that you will configure Solr to provide better highlighting results.

Requirements

A Rails app using Blacklight >=3.2.

Installation

Add

gem "blacklight_highlight"

to your Gemfile and run “bundle install”.

Then run “rails generate blacklight_highlight” to install the appropriate extensions into your CatalogController and SolrDocument classes. In you want to do customize the way this installs, instead you may:

Configuration

You should configure your Solr request handlers to provide the appropriate highlighting results (see <wiki.apache.org/solr/HighlightingParameters>). If you do not add any fields, the Solr default will be used (“ the fields highlighted for the LuceneQParser are the defaultSearchField (or the df param if used) and for the DisMax parser the qf fields are used.”).

Tests

Run ‘rspec`.