Module: Hyrax::CollectionNesting

Extended by:
ActiveSupport::Concern
Included in:
CollectionBehavior, WorkBehavior
Defined in:
app/models/concerns/hyrax/collection_nesting.rb

Overview

TODO:

Consider extracting the update_index callback to ActiveFedora::Base

Responsible for adding the necessary callbacks for updating the nested collection information This is part of the after update index because it is a potentially very expensive process.

Instance Method Summary collapse

Instance Method Details

#find_children_of(destroyed_id:) ⇒ Object


46
47
48
# File 'app/models/concerns/hyrax/collection_nesting.rb', line 46

def find_children_of(destroyed_id:)
  Hyrax::SolrService.query(Hyrax::SolrQueryBuilderService.construct_query(member_of_collection_ids_ssim: destroyed_id))
end

#reindex_extentObject

The following methods allow an option to reindex an object only if the nesting indexer fields are not already in the object's solr document. Added to prevent unnecessary indexing of all ancestors of a parent when one child gets added to the parent. By default, we do the full graph indexing.


59
60
61
# File 'app/models/concerns/hyrax/collection_nesting.rb', line 59

def reindex_extent
  @reindex_extent ||= Hyrax::Adapters::NestingIndexAdapter::FULL_REINDEX
end

#reindex_extent=(val) ⇒ Object


63
64
65
# File 'app/models/concerns/hyrax/collection_nesting.rb', line 63

def reindex_extent=(val)
  @reindex_extent = val
end

#update_index(*args) ⇒ Object


42
43
44
# File 'app/models/concerns/hyrax/collection_nesting.rb', line 42

def update_index(*args)
  _run_update_index_callbacks { super }
end

#use_nested_reindexing?Boolean

Only models which include Hyrax::CollectionNesting will respond to this method. Used to determine whether a model gets reindexed via Samvera::NestingIndexer during full repository reindexing,

Returns:

  • (Boolean)

52
53
54
# File 'app/models/concerns/hyrax/collection_nesting.rb', line 52

def use_nested_reindexing?
  true
end