Module: Spotlight::SolrDocument::ClassMethods
- Defined in:
- app/models/concerns/spotlight/solr_document.rb
Overview
Class-level methods
Instance Method Summary collapse
- #build_for_exhibit(id, exhibit, attributes = {}) ⇒ Object
- #exhibit_slug_field ⇒ Object
- #reindex(id) ⇒ Object
- #reindex_all ⇒ Object
- #resource_type_field ⇒ Object
- #solr_field_for_tagger(tagger) ⇒ Object
- #solr_field_prefix(exhibit) ⇒ Object
- #visibility_field(exhibit) ⇒ Object
Instance Method Details
#build_for_exhibit(id, exhibit, attributes = {}) ⇒ Object
19 20 21 22 23 |
# File 'app/models/concerns/spotlight/solr_document.rb', line 19 def build_for_exhibit(id, exhibit, attributes = {}) new(unique_key => id).tap do |doc| doc.sidecar(exhibit).tap { |x| x.assign_attributes(attributes) }.save! # save is a nop if the sidecar isn't modified. end end |
#exhibit_slug_field ⇒ Object
35 36 37 |
# File 'app/models/concerns/spotlight/solr_document.rb', line 35 def exhibit_slug_field "#{Spotlight::Engine.config.solr_fields.prefix}spotlight_exhibit_slugs#{Spotlight::Engine.config.solr_fields.string_suffix}" end |
#reindex(id) ⇒ Object
25 26 27 28 29 |
# File 'app/models/concerns/spotlight/solr_document.rb', line 25 def reindex(id) find(id).reindex rescue Blacklight::Exceptions::RecordNotFound => e Rails.logger.debug { "Unable to find document #{id}: #{e}" } end |
#reindex_all ⇒ Object
31 32 33 |
# File 'app/models/concerns/spotlight/solr_document.rb', line 31 def reindex_all find_each(&:reindex) end |
#resource_type_field ⇒ Object
47 48 49 |
# File 'app/models/concerns/spotlight/solr_document.rb', line 47 def resource_type_field :"#{Spotlight::Engine.config.solr_fields.prefix}spotlight_resource_type#{Spotlight::Engine.config.solr_fields.string_suffix}" end |
#solr_field_for_tagger(tagger) ⇒ Object
39 40 41 |
# File 'app/models/concerns/spotlight/solr_document.rb', line 39 def solr_field_for_tagger(tagger) :"#{solr_field_prefix(tagger)}tags#{Spotlight::Engine.config.solr_fields.string_suffix}" end |