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 will replace the document field response with the highlighter field (if present). This means that if, for example, you have the field ‘description_t’ in your Blacklight.config, if ‘description_t’ is a ‘highlighted’ field, the result of SolrDocument#get(‘description_t’) *will be* the highlighted version of this feel.

Future versions of this plugin may allow you to selectively request highlighted fields.

Requirements

A Rails app using Blacklight >3.x.

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

There are none. This is bad I know, sorry.