Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
E. Lynette Rayle edited this page Nov 3, 2021 · 4 revisions

Written for Hyrax v3.1.0

Setting up a Hyrax app with postgres adapter

Configurations in Initializer

There are several adjustments that need to be made to /config/initializers/hyrax.rb as compared to the generated initializer in Hyrax at /lib/generators/hyrax/templates/config/initializers/hyrax.rb. Specifically, the following configs are expected to be set as shown below.

  config.collection_model = "Hyrax::PcdmCollection"
  config.query_index_from_valkyrie = true
  config.index_adapter = :solr_index

Additionally, custom queries need to be registered. Place these after the end of the Hyrax.config block.

custom_queries = [Hyrax::CustomQueries::Navigators::CollectionMembers,
                  Hyrax::CustomQueries::Navigators::ChildCollectionsNavigator,
                  Hyrax::CustomQueries::Navigators::ParentCollectionsNavigator,
                  Hyrax::CustomQueries::Navigators::ChildFilesetsNavigator,
                  Hyrax::CustomQueries::Navigators::ChildWorksNavigator,
                  Hyrax::CustomQueries::Navigators::FindFiles,
                  Hyrax::CustomQueries::FindAccessControl,
                  Hyrax::CustomQueries::FindCollectionsByType,
                  Hyrax::CustomQueries::FindFileMetadata,
                  Hyrax::CustomQueries::FindIdsByModel,
                  Hyrax::CustomQueries::FindManyByAlternateIds]
custom_queries.each do |handler|
  Hyrax.query_service.custom_queries.register_query_handler(handler)
end

You will need to configure the solr_config_path for ActiveFedora::SolrService. At the time of this writing, ActiveFedora is still used in some circumstances to read from Solr. Place this after the end of the Hyrax.config block as well.

ActiveFedora.init(solr_config_path: Rails.root.join('config','solr.yml'))
Clone this wiki locally