Sha256: 3dbcd1d29d45c3cbee7f05de1a3086876fec0a54bb23d748a2e25d6114898a87

Contents?: true

Size: 966 Bytes

Versions: 10

Compression:

Stored size: 966 Bytes

Contents

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

    # only get work information
    solr_parameters[:fq] = Hyrax::WorkRelation.new.search_model_clause

    # 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
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 app/search_builders/deposit_search_builder.rb
hyrax-1.1.0 app/search_builders/deposit_search_builder.rb
hyrax-1.0.5 app/search_builders/deposit_search_builder.rb
hyrax-1.0.4 app/search_builders/deposit_search_builder.rb
hyrax-1.0.3 app/search_builders/deposit_search_builder.rb
hyrax-1.0.2 app/search_builders/deposit_search_builder.rb
hyrax-1.0.1 app/search_builders/deposit_search_builder.rb
hyrax-1.0.0.rc2 app/search_builders/deposit_search_builder.rb
hyrax-1.0.0.rc1 app/search_builders/deposit_search_builder.rb
test_hyrax-0.0.1.alpha app/search_builders/deposit_search_builder.rb