Module: Samvera::NestingIndexer
- Defined in:
- lib/samvera/nesting_indexer.rb,
lib/samvera/nesting_indexer/railtie.rb,
lib/samvera/nesting_indexer/version.rb,
lib/samvera/nesting_indexer/adapters.rb,
lib/samvera/nesting_indexer/documents.rb,
lib/samvera/nesting_indexer/exceptions.rb,
lib/samvera/nesting_indexer/configuration.rb,
lib/samvera/nesting_indexer/repository_reindexer.rb,
lib/samvera/nesting_indexer/relationship_reindexer.rb,
lib/samvera/nesting_indexer/adapters/abstract_adapter.rb,
lib/samvera/nesting_indexer/adapters/in_memory_adapter.rb
Overview
Establishing namespace
Defined Under Namespace
Modules: Adapters, Documents, Exceptions Classes: Railtie
Constant Summary collapse
- VERSION =
"1.0.0".freeze
Class Method Summary collapse
-
.adapter ⇒ Object
Exposes the data adapter to use for the reindexing process.
-
.configuration ⇒ Object
(also: config)
Contains the Samvera::NestingIndexer configuration information that is referenceable from wit.
-
.configure(&block) ⇒ Object
Capture the configuration information.
- .configure! ⇒ Object private
-
.reindex_all!(maximum_nesting_depth: configuration.maximum_nesting_depth) ⇒ Boolean
Responsible for reindexing the entire preservation layer.
-
.reindex_relationships(id:, maximum_nesting_depth: configuration.maximum_nesting_depth) ⇒ Boolean
(also: reindex)
Responsible for reindexing the associated document for the given :id and the descendants of that :id.
Class Method Details
.adapter ⇒ Object
Exposes the data adapter to use for the reindexing process.
64 65 66 |
# File 'lib/samvera/nesting_indexer.rb', line 64 def self.adapter configuration.adapter end |
.configuration ⇒ Object Also known as: config
Contains the Samvera::NestingIndexer configuration information that is referenceable from wit
50 51 52 |
# File 'lib/samvera/nesting_indexer.rb', line 50 def self.configuration @configuration ||= Configuration.new end |
.configure(&block) ⇒ Object
Capture the configuration information
75 76 77 78 79 80 81 |
# File 'lib/samvera/nesting_indexer.rb', line 75 def self.configure(&block) @configuration_block = block # The Rails load sequence means that some of the configured Targets may # not be loaded; As such I am not calling configure! instead relying on # Samvera::NestingIndexer::Railtie to handle the configure! call configure! unless defined?(Rails) end |
.configure! ⇒ 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.
84 85 86 87 88 |
# File 'lib/samvera/nesting_indexer.rb', line 84 def self.configure! return false unless @configuration_block.respond_to?(:call) @configuration_block.call(configuration) @configuration_block = nil end |
.reindex_all!(maximum_nesting_depth: configuration.maximum_nesting_depth) ⇒ Boolean
Responsible for reindexing the entire preservation layer.
38 39 40 41 42 43 44 |
# File 'lib/samvera/nesting_indexer.rb', line 38 def self.reindex_all!(maximum_nesting_depth: configuration.maximum_nesting_depth) # While the RepositoryReindexer is responsible for reindexing everything, I # want to inject the lambda that will reindex a single item. id_reindexer = method(:reindex_relationships) RepositoryReindexer.call(maximum_nesting_depth: maximum_nesting_depth, id_reindexer: id_reindexer, configuration: configuration) true end |
.reindex_relationships(id:, maximum_nesting_depth: configuration.maximum_nesting_depth) ⇒ Boolean Also known as: reindex
Responsible for reindexing the associated document for the given :id and the descendants of that :id. In a perfect world we could reindex the id as well; But that is for another test.
22 23 24 25 |
# File 'lib/samvera/nesting_indexer.rb', line 22 def self.reindex_relationships(id:, maximum_nesting_depth: configuration.maximum_nesting_depth) RelationshipReindexer.call(id: id, maximum_nesting_depth: maximum_nesting_depth, configuration: configuration) true end |