Module: Ddr::SolrDocumentBehavior::ClassMethods
- Defined in:
- app/models/concerns/ddr/solr_document_behavior.rb
Instance Method Summary collapse
Instance Method Details
#find(id) ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/models/concerns/ddr/solr_document_behavior.rb', line 15 def find(id) query = Ddr::Index::Query.new { id id } if doc = query.docs.first return doc end raise NotFound, "SolrDocument not found for \"#{id}\"." end |
#find_by_permanent_id(ark) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/models/concerns/ddr/solr_document_behavior.rb', line 23 def find_by_permanent_id(ark) if ark.blank? raise ArgumentError, "ARK argument must be present." end query = Ddr::Index::Query.new do q *:* where permanent_id: ark end if doc = query.docs.first return doc end raise NotFound, "SolrDocument not found for permanent id \"#{ark}\"." end |