app/models/hierarchy_entries_flattened.rb
# This is how a hierarchy gets its ancestry_set. It's not very fast, but
# should only be used during harvesting (and it should be cached after it's
# called):
This is how a hierarchy gets its ancestry_set. It's not very fast, but
should only be used during harvesting (and it should be cached after it's
called).
This is how a hierarchy gets its ancestry_set . It ' s not very fast but should only be used during harvesting ( and it should be cached after it ' s called ) .
def pks_in_hierarchy(hierarchy)
      EOL.log("DEPRECATED: call to HierarchyEntriesFlattened.pks_in_hierarchy",
        prefix: "!")
      pks = Set.new
      ids = hierarchy.hierarchy_entries.pluck(:id)
      num = 0
      done = 0
      ids.in_groups_of(10_000).each do |group|
        EOL.log("pks_in_hierarchy/#{hierarchy.label} (#{hierarchy.id}) "\
          "(#{done += group.size}/#{ids.size})") if ids.size > 10_000
        pks += where(hierarchy_entry_id: group).map do |hef|
          "#{hef.hierarchy_entry_id},#{hef.ancestor_id}"
        end
      end
      pks
    end
def pks_in_hierarchy ( hierarchy ) EOL . log ( "DEPRECATED: call to HierarchyEntriesFlattened.pks_in_hierarchy" , prefix : "!" ) pks = Set . new ids = hierarchy . hierarchy_entries . pluck ( :id ) num = 0 done = 0 ids . in_groups_of ( 10_000 ) . each do | group | EOL . log ( "pks_in_hierarchy/#{hierarchy.label} (#{hierarchy.id}) " "(#{done += group.size}/#{ids.size})" ) if ids . size > 10_000 pks += where ( hierarchy_entry_id : group ) . map do | hef | "#{hef.hierarchy_entry_id},#{hef.ancestor_id}" end end pks end
This is how a hierarchy gets its ancestry_set.
This is how a hierarchy gets its ancestry_set .
# NOTE: This was going REALLY (!!!) slow, so I am skipping it for now: # pks += EOL.pluck_pks(self, where(hierarchy_entry_id: group))
hierarchy
<not_specific>