Sha256: 3d71325c584831ba7cc4b0dee2234f4c85755cce0e5116d90149484b3500521f
Contents?: true
Size: 1.14 KB
Versions: 58
Compression:
Stored size: 1.14 KB
Contents
module Spotlight # Mixin for retrieving solr documents for a specific exhibit module ExhibitDocuments ## # Retrieve all the solr documents associated with this exhibit, appropriately # filtered by the exhibit-specific solr field. # # @return [Enumerable<SolrDocument>] def solr_documents return to_enum(:solr_documents) unless block_given? start = 0 search_params = exhibit_search_builder.merge(q: '*:*', fl: '*') response = repository.search(search_params.start(start).to_h) while response.documents.present? response.documents.each { |x| yield x } start += response.documents.length response = repository.search(search_params.start(start).to_h) end end private def exhibit_search_builder blacklight_config.search_builder_class.new(exhibit_search_builder_context).except(:apply_permissive_visibility_filter) end def exhibit_search_builder_context OpenStruct.new(blacklight_config: blacklight_config, current_exhibit: self) end def repository @repository ||= Blacklight.repository_class.new(blacklight_config) end end end
Version data entries
58 entries across 58 versions & 1 rubygems