Module: BlacklightHighlight::SolrHelperExtension

Defined in:
lib/blacklight_highlight/solr_helper_extension.rb

Overview

Meant to be applied on top of Blacklight helpers

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(some_class) ⇒ Object



3
4
5
# File 'lib/blacklight_highlight/solr_helper_extension.rb', line 3

def self.included some_class
  some_class.solr_search_params_logic += [:solr_highlight_params]
end

Instance Method Details

#solr_highlight_params(solr_parameters, user_parameters) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/blacklight_highlight/solr_helper_extension.rb', line 7

def solr_highlight_params solr_parameters, user_parameters

  if solr_parameters['q'] || solr_parameters['hl.q'] || solr_parameters[:q] || solr_parameters[:'hl.q']
    solr_parameters[:hl] ||= true
    solr_parameters[:'hl.fl'] ||= ''
    solr_parameters[:'hl.fl'] += blacklight_config.index_fields.select { |key, config| config.highlight }.map { |key, config| config.field }.join(",")
  end
end