Sha256: 241db9b025c21a40112f4610b63c4fe9149f67c232f8679ffde1629d7db7aa5d
Contents?: true
Size: 1.61 KB
Versions: 6
Compression:
Stored size: 1.61 KB
Contents
# frozen_string_literal: true module Arclight ## # Customized Search Behavior for Arclight module SearchBehavior extend ActiveSupport::Concern included do self.default_processor_chain += %i[ add_hierarchy_max_rows add_hierarchy_sort add_highlighting add_grouping ] end ## # Override Blacklight's method so that some views don't add Solr facets into the request. def add_facetting_to_solr(solr_params) if %w[collection_context online_contents].include? blacklight_params[:view] return solr_params end super(solr_params) end ## # For the collection_context views, set a higher (unlimited) maximum document return def add_hierarchy_max_rows(solr_params) if %w[collection_context].include? blacklight_params[:view] solr_params[:rows] = 999_999_999 end solr_params end ## # For the asynch views, set the sort order to preserve the order of components def add_hierarchy_sort(solr_params) solr_params[:sort] = 'sort_ii asc' if %w[online_contents collection_context].include? blacklight_params[:view] solr_params end ## # Add highlighting def add_highlighting(solr_params) solr_params['hl'] = true solr_params['hl.fl'] = 'text' solr_params['hl.snippets'] = 3 solr_params end ## # Adds grouping parameters for Solr if enabled def add_grouping(solr_params) solr_params.merge!(Arclight::Engine.config.catalog_controller_group_query_params) if blacklight_params[:group] == 'true' solr_params end end end
Version data entries
6 entries across 6 versions & 1 rubygems