-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Cheatsheet
Tiffany Chan edited this page Mar 16, 2020
·
24 revisions
-
resourceis aSpotlight::Resourceobject -
documentis aSolrDocument(sometimes::SolrDocument) object -
blacklight_urlis the link to the Spotlight Solr instance
- Create a new imported resource
- Get a resource's file type (image, compound object, etc.)
- Get the file type of a compound object
- Check if a resource/document is imported or uploaded
- Check if a compound object is imported or uploaded
- Delete a resource and document
- Get URLs for Vault resources
Mandatory attributes:
-
url= The url to an IIIF manifest exhibit_id
Optional attributes:
-
file_nameNote:resource.file_typewon't work if this is empty -
data= metadata for the resource. If this is pre-filled, Spotlight will use this data. If blank, it will autofill based on the source manifest.
Spotlight::Resources::IiifHarvester.create( url: url, exhibit_id: exhibit.id, file_name: "default.jpg", data: row)See create method for imported resources | See VaultIiifManifest for what gets indexed to Solr or saved in resource, document, and sidecar
Returns one of the following: "image", "compound_object", "video/audio", "video", "audio", "pdf","model", "unknown"
resource.file_type
#=> "image"resource.made_of?
# => "image"resource.imported? #=> true/false
document.uploaded_resource? #=> true/falseSee .imported? definition | See .uploaded_resource? definition
resource.imported_compound_object?
#=> true/falseThis is what the delete button does in Curation > Items view. First we delete the document:
solr = RSolr.connect :url => 'blacklight_url'
doc_id = resource.compound_id
solr.delete_by_id doc_id
solr.commitDestroy the resource:
resource.destroySee the full method defined in the destroy action.
document["content_metadata_image_iiif_info_ssm"]