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_hierarchy_max_rows(solr_params) ⇒ Object

For the hierarchy view, set a higher (unlimited) maximum document return



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

def add_hierarchy_max_rows(solr_params)
  if blacklight_params[:view] == 'hierarchy'
    solr_params[:rows] = 999_999_999
  end
  solr_params
end

#add_hierarchy_sort(solr_params) ⇒ Object

For the hierarchy view, set the sort order to preserve the order of components



28
29
30
31
# File 'app/models/concerns/arclight/search_behavior.rb', line 28

def add_hierarchy_sort(solr_params)
  solr_params[:sort] = 'sort_ii asc' if blacklight_params[:view] == 'hierarchy'
  solr_params
end

#add_highlighting(solr_params) ⇒ Object

Disable highlighting for hiearchy, and enable it for all other searches



35
36
37
38
39
40
41
42
43
44
# File 'app/models/concerns/arclight/search_behavior.rb', line 35

def add_highlighting(solr_params)
  if blacklight_params[:view] == 'hierarchy'
    solr_params['hl'] = false
  else
    solr_params['hl'] = true
    solr_params['hl.fl'] = 'text'
    solr_params['hl.snippets'] = 3
  end
  solr_params
end