Method: Sufia::SolrDocumentBehavior#collections

Defined in:
app/models/concerns/sufia/solr_document_behavior.rb

#collectionsObject

Find the solr documents for the collections this object belongs to



65
66
67
68
69
70
71
72
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 65

def collections
  return @collections if @collections
  query = 'id:' + collection_ids.map { |id| '"' + id + '"' }.join(' OR ')
  result = Blacklight.default_index.connection.select(params: { q: query })
  @collections = result['response']['docs'].map do |hash|
    ::SolrDocument.new(hash)
  end
end