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

#solr_documentsEnumerable<SolrDocument>

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

Returns:



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

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