blacklight_facet_extras

Stars
4

BlacklightFacetExtras: Blacklight plugin that exposes Solr facet parameters (range, query, tagging + exclusions, etc) to Blacklight

= Description

BlacklightFacetExtras adds some ugly parsing and manipulating to the Blacklight solr configuration and solr parameter parsing, but seems to get the job done, more or less.

= Requirements

A Rails app using Blacklight >=3.2.

= Installation

Add

gem "blacklight_highlight"

to your Gemfile and run "bundle install".

For each "extras" component you plan to use, you need to mixin the appropriate extension into your Catalogcontroller, e.g.

include BlacklightFacetExtras::Pivot::ControllerExtension

= Configuration

After mixing-in the controller extension, additional parameters will be available in your facet configuration:

CatalogController.configure_blacklight do |config|

    config.add_facet_field 'hierarchy_facet', :hierarchy => true
    config.add_facet_field 'facet', :multiple => true
    config.add_facet_field 'first_facet,last_facet', :pivot => ['first_facet', 'last_facet']
    config.add_facet_field 'my_query_field', :query => { 'label' => 'value:1', 'label2' => 'value:2'}
    config.add_facet_field 'facet', :single => true
    config.add_facet_field 'facet', :tag => 'my_tag', :ex => 'my_tag'

    config.default_solr_params[:'facet.field'] = config.facet_fields.keys
  end

In general, the acceptance tests (in spec/acceptance) are your best bet for discovering configuration parameters.

If you do not have Blacklight add the Solr facet.field parameter, you may need to ensure your Solr request handler is configured to return appropriate results (especially for e.g. single + multiple select facets)