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


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

def find_children_of(destroyed_id:)
  ActiveFedora::SolrService.query(ActiveFedora::SolrQueryBuilder.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.


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

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

#reindex_extent=(val) ⇒ Object


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

def reindex_extent=(val)
  @reindex_extent = val
end

#update_index(*args) ⇒ Object


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

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)

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

def use_nested_reindexing?
  true
end