Sha256: 0629f6ae191b333496462859e5539a3ea6aca97a0533d79c3a88c9ad7fb2f08d

Contents?: true

Size: 1.26 KB

Versions: 11

Compression:

Stored size: 1.26 KB

Contents

# Meant to be applied on top of a controller that implements
# Blacklight::SolrHelper. Will inject range limiting behaviors
# to solr parameters creation.
require 'blacklight_range_limit/segment_calculation'
module BlacklightRangeLimit
  module ControllerOverride
    extend ActiveSupport::Concern

    included do
      helper BlacklightRangeLimit::ViewHelperOverride
      helper RangeLimitHelper
    end

    # Action method of our own!
    # Delivers a _partial_ that's a display of a single fields range facets.
    # Used when we need a second Solr query to get range facets, after the
    # first found min/max from result set.
    def range_limit
      # We need to swap out the add_range_limit_params search param filter,
      # and instead add in our fetch_specific_range_limit filter,
      # to fetch only the range limit segments for only specific
      # field (with start/end params) mentioned in query params
      # range_field, range_start, and range_end

      @response, _ = search_results(params) do |search_builder|
        search_builder.except(:add_range_limit_params).append(:fetch_specific_range_limit)
      end

      render('blacklight_range_limit/range_segments', :locals => {:solr_field => params[:range_field]}, :layout => !request.xhr?)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
blacklight_range_limit-6.4.0 lib/blacklight_range_limit/controller_override.rb
blacklight_range_limit-6.3.3 lib/blacklight_range_limit/controller_override.rb
blacklight_range_limit-6.3.2 lib/blacklight_range_limit/controller_override.rb
blacklight_range_limit-6.3.1 lib/blacklight_range_limit/controller_override.rb
blacklight_range_limit-6.3.0 lib/blacklight_range_limit/controller_override.rb
blacklight_range_limit-6.2.1 lib/blacklight_range_limit/controller_override.rb
blacklight_range_limit-6.2.0 lib/blacklight_range_limit/controller_override.rb
blacklight_range_limit-6.1.2 lib/blacklight_range_limit/controller_override.rb
blacklight_range_limit-6.1.1 lib/blacklight_range_limit/controller_override.rb
blacklight_range_limit-6.1.0 lib/blacklight_range_limit/controller_override.rb
blacklight_range_limit-6.0.0 lib/blacklight_range_limit/controller_override.rb