class Krikri::Indexer

A SoftwareAgent to run indexing processes.

@example 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`.

@todo use generalized `EntityConsumer` interface that is independent from

`Activity`. `#index` needs to be largely rewritten due to 
`#update_from_activity`, which is tighly bound to `Activity` rather than
`Enumerator<#entities>`.

@see Krikri::SoftwareAgent#enqueue

Attributes

index[R]
index_class[R]
index_opts[R]

Public Class Methods

new(opts = {}) click to toggle source
# File lib/krikri/indexer.rb, line 30
def initialize(opts = {})
  assign_generator_activity!(opts)
  @index_class = opts.delete(:index_class)
  @index_opts = opts
end
queue_name() click to toggle source
# File lib/krikri/indexer.rb, line 26
def self.queue_name
  :indexing
end

Public Instance Methods

run() click to toggle source
# File lib/krikri/indexer.rb, line 40
def run
  index.update_from_activity(generator_activity)
end