Class: Krikri::Indexer

Inherits:
Object
  • Object
show all
Includes:
EntityConsumer, SoftwareAgent
Defined in:
lib/krikri/indexer.rb

Overview

A SoftwareAgent to run indexing processes.

Examples:


To index records enriched by the enrichment activity with ID 3:

Krikri::Indexer.enqueue({
  index_class: 'Krikri::QASearchIndex',
  generator_uri: 'http://ldp.local.dp.la/ldp/activity/3'
  some_option_for_index_class: 'abc'
})

The options hash contains options for the Indexer as well as the
SearchIndex.

See Also:

  • SoftwareAgent#enqueue

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from EntityConsumer

#assign_generator_activity!

Methods included from SoftwareAgent

#agent_name, #entity_behavior

Constructor Details

#initialize(opts = {}) ⇒ Indexer

Returns a new instance of Indexer.



30
31
32
33
34
# File 'lib/krikri/indexer.rb', line 30

def initialize(opts = {})
  assign_generator_activity!(opts)
  @index_class = opts.delete(:index_class)
  @index_opts = opts
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



24
25
26
# File 'lib/krikri/indexer.rb', line 24

def index
  @index
end

#index_classObject (readonly)

Returns the value of attribute index_class.



24
25
26
# File 'lib/krikri/indexer.rb', line 24

def index_class
  @index_class
end

#index_optsObject (readonly)

Returns the value of attribute index_opts.



24
25
26
# File 'lib/krikri/indexer.rb', line 24

def index_opts
  @index_opts
end

Class Method Details

.queue_nameObject



26
27
28
# File 'lib/krikri/indexer.rb', line 26

def self.queue_name
  :indexing
end

Instance Method Details

#runObject



40
41
42
# File 'lib/krikri/indexer.rb', line 40

def run
  index.update_from_activity(generator_activity)
end