lib/ddr/models/solr_document.rb in ddr-models-2.5.3 vs lib/ddr/models/solr_document.rb in ddr-models-2.6.0.rc1

- old
+ new

@@ -16,9 +16,17 @@ if doc = query.docs.first return doc end raise NotFound, "SolrDocument not found for \"#{pid_or_uri}\"." end + + 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 end def inspect "#<#{self.class.name} id=#{id.inspect}>" end