Sha256: 5c992cdc63215650de123de3ba48efdb87d79b164134682db7b254100dd75add

Contents?: true

Size: 974 Bytes

Versions: 39

Compression:

Stored size: 974 Bytes

Contents

module Hyrax
  class DepositSearchBuilder < ::SearchBuilder
    # includes the depositor_facet to get information on deposits.
    # use caution when combining this with other searches as it sets the rows to
    # zero to just get the facet information
    # @param solr_parameters the current solr parameters
    def include_depositor_facet(solr_parameters)
      solr_parameters[:"facet.field"].concat([DepositSearchBuilder.depositor_field])

      # default facet limit is 10, which will only show the top 10 users.
      # As we want to show all user deposits, so set the facet.limit to the
      # the number of users in the database
      solr_parameters[:"facet.limit"] = ::User.count

      # we only want the facte counts not the actual data
      solr_parameters[:rows] = 0
    end

    def self.depositor_field
      @depositor_field ||= Solrizer.solr_name('depositor', :symbol).freeze
    end

    private

      def only_works?
        true
      end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.9.5 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.9.4 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.9.3 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.9.2 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.9.1 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.9.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.8.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.7.2 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.7.1 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.7.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.6.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.5.1 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.5.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.4.1 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.0.0.pre.beta1 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.4.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.3.3 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.3.2 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-2.3.1 app/search_builders/hyrax/deposit_search_builder.rb