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
-
#add_grouping(solr_params) ⇒ Object
Adds grouping parameters for Solr if enabled.
-
#add_hierarchy_behavior(solr_parameters) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity.
-
#add_highlighting(solr_params) ⇒ Object
Add highlighting.
Instance Method Details
#add_grouping(solr_params) ⇒ Object
Adds grouping parameters for Solr if enabled
46 47 48 49 50 |
# File 'app/models/concerns/arclight/search_behavior.rb', line 46 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 28 29 30 31 32 |
# 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 # The default fl includes `collection:[subquery]`, which runs a separate # Solr subquery to look up the parent collection for every returned # component (this can be slow). The hierarchy view does not use the collection # subquery, so drop it here and return stored fields. solr_parameters[:fl] = '*' end |
#add_highlighting(solr_params) ⇒ Object
Add highlighting
37 38 39 40 41 42 |
# File 'app/models/concerns/arclight/search_behavior.rb', line 37 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 |