Sha256: b1d94a173afec3cee13a9c67cddc37b454b71eb197147627d85cc93ba67efd84

Contents?: true

Size: 625 Bytes

Versions: 4

Compression:

Stored size: 625 Bytes

Contents

module CurationConcerns
  # Finds objects under lease
  class LeaseSearchBuilder < Blacklight::SearchBuilder
    self.default_processor_chain = [:with_pagination, :with_sorting, :only_active_leases]
    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] = 'lease_expiration_date_dtsi desc'
    end

    def only_active_leases(solr_params)
      solr_params[:fq] ||= []
      solr_params[:fq] = 'lease_expiration_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/lease_search_builder.rb
curation_concerns-0.4.0 app/search_builders/curation_concerns/lease_search_builder.rb
curation_concerns-0.3.0 app/search_builders/curation_concerns/lease_search_builder.rb
curation_concerns-0.2.0 app/search_builders/curation_concerns/lease_search_builder.rb