Skip to content

Commit

Permalink
stop indexing collection if they aren't public
Browse files Browse the repository at this point in the history
  • Loading branch information
dnoneill committed Feb 5, 2024
1 parent e0491c8 commit 18e571e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/public_xml_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def initialize(druid, purl_url: 'https://purl.stanford.edu')
end

def searchworks_id
return nil unless collection_in_searchworks?
catkey.nil? ? druid : catkey
end

Expand All @@ -31,9 +32,19 @@ def catkey

# @return objectLabel value from the DOR identity_metadata, or nil if there is no barcode
def label
return nil unless collection_in_searchworks?
get_value(public_xml_doc.xpath('/publicObject/identityMetadata/objectLabel'))
end

def collection_in_searchworks?
return true unless collection?
if public_xml_doc.xpath("/publicObject/releaseData").present?
get_value(public_xml_doc.xpath('/publicObject/releaseData/release[@to="Searchworks"]')) == "true"
else
false
end
end

def get_value(node)
node && node.first ? node.first.content : nil
end
Expand Down

0 comments on commit 18e571e

Please sign in to comment.