Last active
April 14, 2021 06:02
-
-
Save cjcolvar/8f0485e3cf88307228447726b6b55dd3 to your computer and use it in GitHub Desktop.
Monkey-patch initializer to request ntriples when reindexing to avoid timeouts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveFedora::Fedora.class_eval do | |
def ntriples_connection | |
authorized_connection.tap { |conn| conn.headers['Accept'] = 'application/n-triples' } | |
end | |
def build_ntriples_connection | |
ActiveFedora::InitializingConnection.new(ActiveFedora::CachingConnection.new(ntriples_connection, omit_ldpr_interaction_model: true), root_resource_path) | |
end | |
end | |
ActiveFedora::Indexing::DescendantFetcher.class_eval do | |
private | |
def rdf_resource | |
@rdf_resource ||= Ldp::Resource::RdfSource.new(ActiveFedora.fedora.build_ntriples_connection, uri) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment