Module: ActiveFedora::Indexing

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/active_fedora/indexing.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#indexing_serviceObject



13
14
15
# File 'lib/active_fedora/indexing.rb', line 13

def indexing_service
  @indexing_service ||= self.class.indexer.new(self)
end

#to_solr(solr_doc = Hash.new, opts = {}) ⇒ Object

Return a Hash representation of this object where keys in the hash are appropriate Solr field names. If opts == true, the base object metadata and the RELS-EXT datastream will be omitted. This is mainly to support shelver, which calls .to_solr for each model an object subscribes to.

Parameters:

  • solr_doc (Hash) (defaults to: Hash.new)

    (optional) Hash to insert the fields into

  • opts (Hash) (defaults to: {})

    (optional)



9
10
11
# File 'lib/active_fedora/indexing.rb', line 9

def to_solr(solr_doc = Hash.new, opts={})
  indexing_service.generate_solr_document
end

#update_indexObject

Updates Solr index with self.



18
19
20
# File 'lib/active_fedora/indexing.rb', line 18

def update_index
  SolrService.add(to_solr, softCommit: true)
end