Module: Spotlight::ExhibitDocuments

Included in:
Exhibit
Defined in:
app/models/concerns/spotlight/exhibit_documents.rb

Overview

Mixin for retrieving solr documents for a specific exhibit

Instance Method Summary collapse

Instance Method Details

#exhibit_search_builderObject



26
27
28
# File 'app/models/concerns/spotlight/exhibit_documents.rb', line 26

def exhibit_search_builder
  blacklight_config.search_builder_class.new(exhibit_search_builder_context).except(:apply_permissive_visibility_filter)
end

#solr_documentsEnumerable<SolrDocument>

Retrieve all the solr documents associated with this exhibit, appropriately filtered by the exhibit-specific solr field.

Returns:



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/concerns/spotlight/exhibit_documents.rb', line 11

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