Class: BaseIndexer::MainIndexerEngine

Inherits:
Object
  • Object
show all
Defined in:
lib/base_indexer/main_indexer_engine.rb

Overview

It is responsible for performing the basic indexing steps, it includes reading the input from PURL server, getting collection names, mapping it to solr doc hash, and write it to SOLR core . It can also delete the object from all the registered

Examples:

Index with target list

indexer = BaseIndexer::MainIndexerEngine.new
indexer.index "ab123cd456", ["searchworks","revs"]

Index from release_tags

indexer = BaseIndexer::MainIndexerEngine.new
indexer.index "ab123cd456"

Delete item from all solr cores

indexer = BaseIndexer::MainIndexerEngine.new
indexer.delete "ab123cd456"

Instance Method Summary collapse

Instance Method Details

#delete(druid) ⇒ Object

It deletes an item defined by druid from all registered solr core

Parameters:

  • druid (String)

    is the druid for an object e.g., ab123cd4567



35
36
37
# File 'lib/base_indexer/main_indexer_engine.rb', line 35

def delete(druid)
  solr_writer.solr_delete_from_all(druid)
end

#index(druid, targets) ⇒ Object

It is the main indexing function

Parameters:

  • druid (String)

    is the druid for an object e.g., ab123cd4567

  • targets (Array)

    is an array with the targets list to index towards

Raises:

  • it will raise erros if there is any problems happen in any level



25
26
27
28
29
30
31
# File 'lib/base_indexer/main_indexer_engine.rb', line 25

def index(druid, targets)
  # Map the input to solr_doc
  solr_doc = mapper_class.new(druid).convert_to_solr_doc

  # Get SOLR configuration and write
  solr_writer.process(druid, solr_doc, targets)
end