Sha256: 936fecce30dc410e29275c31317cb999eec55ca20cb249312b70aa8264918337

Contents?: true

Size: 629 Bytes

Versions: 4

Compression:

Stored size: 629 Bytes

Contents

module CurationConcerns
  # Finds embargoed objects
  class EmbargoSearchBuilder < Blacklight::SearchBuilder
    self.default_processor_chain = [:with_pagination, :with_sorting, :only_active_embargoes]
    def initialize(scope)
      super(true, scope)
    end

    # TODO: add more complex pagination
    def with_pagination(solr_params)
      solr_params[:rows] = 1000
    end

    def with_sorting(solr_params)
      solr_params[:sort] = 'embargo_release_date_dtsi desc'
    end

    def only_active_embargoes(solr_params)
      solr_params[:fq] ||= []
      solr_params[:fq] = 'embargo_release_date_dtsi:*'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
curation_concerns-0.5.0 app/search_builders/curation_concerns/embargo_search_builder.rb
curation_concerns-0.4.0 app/search_builders/curation_concerns/embargo_search_builder.rb
curation_concerns-0.3.0 app/search_builders/curation_concerns/embargo_search_builder.rb
curation_concerns-0.2.0 app/search_builders/curation_concerns/embargo_search_builder.rb