Sha256: 1612ac44d92456c5ff8e27848db29c4dddfb7f64826eeb24a73d876f96886d90

Contents?: true

Size: 948 Bytes

Versions: 4

Compression:

Stored size: 948 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 file information
    solr_parameters[:fq] = "has_model_ssim:GenericWork"

    # 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

4 entries across 4 versions & 1 rubygems

Version Path
sufia-7.0.0.beta4 app/search_builders/deposit_search_builder.rb
sufia-7.0.0.beta3 app/search_builders/deposit_search_builder.rb
sufia-7.0.0.beta2 app/search_builders/deposit_search_builder.rb
sufia-7.0.0.beta1 app/search_builders/deposit_search_builder.rb