Module: Hyrax::CollectionNesting

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

Overview

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



55
56
57
# File 'app/models/concerns/hyrax/collection_nesting.rb', line 55

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.



68
69
70
# File 'app/models/concerns/hyrax/collection_nesting.rb', line 68

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

#reindex_extent=(val) ⇒ Object



72
73
74
# File 'app/models/concerns/hyrax/collection_nesting.rb', line 72

def reindex_extent=(val)
  @reindex_extent = val
end

#update_index(*args) ⇒ Object



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

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)


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

def use_nested_reindexing?
  true
end