Sha256: 0d5594cd63d8e4432d540847b9f50df67a59c2954ba5c434ed4cee690d3e6fa6

Contents?: true

Size: 946 Bytes

Versions: 14

Compression:

Stored size: 946 Bytes

Contents

# frozen_string_literal: true
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_ssim"
    end

    private

    def only_works?
      true
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hyrax-3.6.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.5.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.4.2 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.4.1 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.4.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.3.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.2.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.1.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.0.2 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.0.1 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.0.0 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.0.0.pre.rc4 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.0.0.pre.rc3 app/search_builders/hyrax/deposit_search_builder.rb
hyrax-3.0.0.pre.rc2 app/search_builders/hyrax/deposit_search_builder.rb