Module: Ddr::Models::SolrDocument::ClassMethods
- Defined in:
- lib/ddr/models/solr_document.rb
Instance Method Summary collapse
Instance Method Details
#find(pid_or_uri) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/ddr/models/solr_document.rb', line 17 def find(pid_or_uri) query = Ddr::Index::Query.new { id pid_or_uri.sub(/\Ainfo:fedora\//, "") } if doc = query.docs.first return doc end raise NotFound, "SolrDocument not found for \"#{pid_or_uri}\"." end |
#find_by_permanent_id(ark) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/ddr/models/solr_document.rb', line 25 def find_by_permanent_id(ark) query = Ddr::Index::Query.new { where permanent_id: ark } if doc = query.docs.first return doc end raise NotFound, "SolrDocument not found for permanent id \"#{ark}\"." end |