Class: Spotlight::SolrDocumentSidecar

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
ActsAsTaggableOn::Taggable
Defined in:
app/models/spotlight/solr_document_sidecar.rb

Overview

Exhibit-specific metadata for indexed documents

Instance Method Summary collapse

Instance Method Details

#default_document_typeObject



45
46
47
# File 'app/models/spotlight/solr_document_sidecar.rb', line 45

def default_document_type
  blacklight_config.document_model
end

#documentObject

Roll our own polymorphism because our documents are not AREL-able



41
42
43
# File 'app/models/spotlight/solr_document_sidecar.rb', line 41

def document
  document_type_class.new document_type_class.unique_key => document_id
end

#private!Object



32
33
34
# File 'app/models/spotlight/solr_document_sidecar.rb', line 32

def private!
  update public: false
end

#public!Object



36
37
38
# File 'app/models/spotlight/solr_document_sidecar.rb', line 36

def public!
  update public: true
end

#to_solrObject



25
26
27
28
29
30
# File 'app/models/spotlight/solr_document_sidecar.rb', line 25

def to_solr
  { document.class.unique_key.to_sym => document.id,
    visibility_field => public? }
    .merge(data_to_solr)
    .merge(exhibit.solr_data)
end