Class: Samvera::NestingIndexer::RepositoryReindexer Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/samvera/nesting_indexer/repository_reindexer.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Note:

There is cycle detection logic for walking the graph prior to attempting relationship re-indexing

Responsible for reindexing the entire repository

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(maximum_nesting_depth:, id_reindexer:, configuration:, extent:) ⇒ RepositoryReindexer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RepositoryReindexer.

Parameters:

  • id_reindexer (#call)

    Samvera::NestingIndexer.method(:reindex_relationships) Responsible for reindexing a single object

  • maximum_nesting_depth (Integer)

    detect cycles in the graph

  • configuration (#adapter, #logger)

    The :adapter conforms to the Samvera::NestingIndexer::Adapters::AbstractAdapter interface and the :logger conforms to Logger



25
26
27
28
29
30
31
# File 'lib/samvera/nesting_indexer/repository_reindexer.rb', line 25

def initialize(maximum_nesting_depth:, id_reindexer:, configuration:, extent:)
  @maximum_nesting_depth = maximum_nesting_depth.to_i
  @id_reindexer = id_reindexer
  @configuration = configuration
  @extent = extent
  @processed_ids = []
end

Class Method Details

.call(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

This could crush your system as it will loop through ALL the documents

A convenience method to reindex all documents.

Returns:

  • Samvera::NestingIndexer::RepositoryReindexer

See Also:



17
18
19
# File 'lib/samvera/nesting_indexer/repository_reindexer.rb', line 17

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

TODO:

Would it make sense to leverage an each_preservation_id instead?



34
35
36
37
38
# File 'lib/samvera/nesting_indexer/repository_reindexer.rb', line 34

def call
  adapter.each_perservation_document_id_and_parent_ids do |id, parent_ids|
    recursive_reindex(id: id, parent_ids: parent_ids, time_to_live: maximum_nesting_depth)
  end
end