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 6520c7a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/public_xml_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ 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 +33,21 @@ 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 6520c7a

Please sign in to comment.