Module: Sufia::SolrDocumentBehavior
- Extended by:
- ActiveSupport::Concern
- Includes:
- CurationConcerns::Permissions::Readable, Hydra::Works::MimeTypes, Sufia::SolrDocument::Characterization, Sufia::SolrDocument::Export
- Defined in:
- app/models/concerns/sufia/solr_document_behavior.rb
Instance Method Summary collapse
- #admin_set ⇒ Object
-
#based_near ⇒ Object
TODO: Move to curation_concerns?.
- #collection_ids ⇒ Object
-
#collections ⇒ Object
Find the solr documents for the collections this object belongs to.
- #create_date ⇒ Object
-
#date_created ⇒ Object
Date created indexed as a string.
- #edit_groups ⇒ Object
- #edit_people ⇒ Object
-
#identifier ⇒ Object
TODO: Move to curation_concerns?.
-
#itemtype ⇒ Object
Add a schema.org itemtype.
- #read_groups ⇒ Object
-
#related_url ⇒ Object
TODO: Move to curation_concerns?.
- #resource_type ⇒ Object
Methods included from Sufia::SolrDocument::Characterization
#byte_order, #capture_device, #color_map, #color_space, #compression, #gps_timestamp, #height, #image_producer, #latitude, #longitude, #orientation, #profile_name, #profile_version, #scanning_software, #width
Methods included from Sufia::SolrDocument::Export
#end_note_format, #endnote_filename, #export_as_endnote, #persistent_url
Instance Method Details
#admin_set ⇒ Object
60 61 62 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 60 def admin_set fetch(Solrizer.solr_name('admin_set'), []) end |
#based_near ⇒ Object
TODO: Move to curation_concerns?
31 32 33 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 31 def based_near self[Solrizer.solr_name('based_near')] end |
#collection_ids ⇒ Object
56 57 58 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 56 def collection_ids Array.wrap(self['collection_ids_tesim']) end |
#collections ⇒ Object
Find the solr documents for the collections this object belongs to
65 66 67 68 69 70 71 72 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 65 def collections return @collections if @collections query = 'id:' + collection_ids.map { |id| '"' + id + '"' }.join(' OR ') result = Blacklight.default_index.connection.select(params: { q: query }) @collections = result['response']['docs'].map do |hash| ::SolrDocument.new(hash) end end |
#create_date ⇒ Object
21 22 23 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 21 def create_date date_field('system_create') end |
#date_created ⇒ Object
Date created indexed as a string. This allows users to enter values like: ‘Circa 1840-1844’ This overrides the default behavior of CurationConcerns which indexes a date
17 18 19 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 17 def date_created fetch(Solrizer.solr_name("date_created"), []) end |
#edit_groups ⇒ Object
48 49 50 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 48 def edit_groups Array.wrap(self[::Ability.edit_group_field]) end |
#edit_people ⇒ Object
52 53 54 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 52 def edit_people Array.wrap(self[::Ability.edit_user_field]) end |
#identifier ⇒ Object
TODO: Move to curation_concerns?
26 27 28 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 26 def identifier self[Solrizer.solr_name('identifier')] end |
#itemtype ⇒ Object
Add a schema.org itemtype
11 12 13 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 11 def itemtype ResourceTypesService.microdata_type(resource_type.first) end |
#read_groups ⇒ Object
44 45 46 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 44 def read_groups Array.wrap(self[::Ability.read_group_field]) end |
#related_url ⇒ Object
TODO: Move to curation_concerns?
36 37 38 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 36 def self[Solrizer.solr_name('related_url')] end |
#resource_type ⇒ Object
40 41 42 |
# File 'app/models/concerns/sufia/solr_document_behavior.rb', line 40 def resource_type Array.wrap(self[Solrizer.solr_name("resource_type")]) end |