Module: Arclight::SearchBehavior

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/arclight/search_behavior.rb

Overview

Customized Search Behavior for Arclight

Instance Method Summary collapse

Instance Method Details

#add_grouping(solr_params) ⇒ Object

Adds grouping parameters for Solr if enabled



41
42
43
44
45
# File 'app/models/concerns/arclight/search_behavior.rb', line 41

def add_grouping(solr_params)
  solr_params.merge!(Arclight::Engine.config.catalog_controller_group_query_params) if blacklight_params[:group] == 'true'

  solr_params
end

#add_hierarchy_behavior(solr_parameters) ⇒ Object

rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity



18
19
20
21
22
23
24
25
26
27
# File 'app/models/concerns/arclight/search_behavior.rb', line 18

def add_hierarchy_behavior(solr_parameters)
  return unless search_state.controller&.action_name == 'hierarchy'

  solr_parameters[:fq] ||= []
  solr_parameters[:fq] << "_nest_parent_:#{blacklight_params[:id]}"
  solr_parameters[:rows] = blacklight_params[:per_page]&.to_i || blacklight_params[:limit]&.to_i || 999_999_999
  solr_parameters[:start] = blacklight_params[:offset] if blacklight_params[:offset]
  solr_parameters[:sort] = 'sort_isi asc'
  solr_parameters[:facet] = false
end

#add_highlighting(solr_params) ⇒ Object

Add highlighting



32
33
34
35
36
37
# File 'app/models/concerns/arclight/search_behavior.rb', line 32

def add_highlighting(solr_params)
  solr_params['hl'] = true
  solr_params['hl.fl'] = CatalogController.blacklight_config.highlight_field
  solr_params['hl.snippets'] = 3
  solr_params
end