Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

Revert indexers work from #461 #471

Merged
merged 1 commit into from
Aug 27, 2020
Merged

Revert indexers work from #461 #471

merged 1 commit into from
Aug 27, 2020

Conversation

mjgiarlo
Copy link
Member

@mjgiarlo mjgiarlo commented Aug 26, 2020

Why was this change made?

Because it breaks production and people have work to do.

Re-opens #457 which will be discussed on Tuesday.

How was this change tested?

CI. This has been confirmed to work in both stage and prod, tested by @amyehodge and @aaron-collier and myself.

Which documentation and/or configurations were updated?

None

Because it breaks production and people have work to do.

Re-opens #457 which will be discussed on Tuesday.
@mjgiarlo mjgiarlo force-pushed the revert-indexers#457,461 branch from e6cb144 to a604518 Compare August 26, 2020 22:27
@mjgiarlo mjgiarlo changed the title Revert indexers work from #461 [HOLD] Revert indexers work from #461 Aug 26, 2020
@mjgiarlo mjgiarlo changed the title [HOLD] Revert indexers work from #461 Revert indexers work from #461 Aug 27, 2020
@mjgiarlo
Copy link
Member Author

NOTE: We determined that a possibley related error w/ the homepage not rendering was being caused in the stage environment due to bad data in solr (root cause unknown but possibly related to either recent indexing changes or integration tests not doing the right thing). If we see this error again in any environment, drop into a console and execute the following commands (from the Hydrus collection class) to determine which collections are affected:

user = User.find_by(email: 'mjgiarlo@stanford.edu') # make sure to specify user that is seeing the bug
apo_pids = Hydrus::Collection.apos_involving_user(user) # get user's APOs
coll_pids = Hydrus::Collection.collections_of_apos(apo_pids) # get user's collections
initial_item_counts = Hash[Hydrus::GenericObject.status_labels(:item).keys.map { |s| [s, 0] }] # get item counts
counts = Hash[coll_pids.map { |cp| [cp, initial_item_counts] }] # get item counts from collections
h = Hydrus::Collection.squery_item_counts_of_collections(counts.keys) # generate Solr query given counts from collections
resp, sdocs = Hydrus::Collection.issue_solr_query(h) # issue the Solr query and store results
collection_druids = Hydrus::Collection.get_facet_counts_from_response(resp).map { |fc| fc['value'] if fc['pivot'].nil? }.compact.map { |fedora_uri| fedora_
uri.delete_prefix('info:fedora/') } # iterate over collection facet counts and return druids of collections that would cause homepage to raise exception
collection_druids.each do |collection_druid|
  Hydrus::Collection.find(collection_druid).items.each do |child_item|
    ActiveFedora.solr.conn.add(child_item.to_solr, add_attributes: { commitWithin: 1000 })
  end
  ActiveFedora.solr.conn.add(Hydrus::Collection.find(collection_druid).to_solr, add_attributes: { commitWithin: 1000 })
end

@mjgiarlo mjgiarlo merged commit ec81bb6 into master Aug 27, 2020
@mjgiarlo mjgiarlo deleted the revert-indexers#457,461 branch August 27, 2020 20:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants