Skip to content

Configuring the OAI PMH service

Anusha Ranganathan edited this page Jun 7, 2021 · 1 revision

While the plugin provides some generic defaults out of the box, you probably will want to customize the OAI provider configuration. All configuration parameters are optional.

  • Include the OAI configuration options in the controller
    In app/controllers/catalog_controller.rb add the following lines
    configure_blacklight do |config|
      config.oai = OAI_CONFIG
    end
    
  • Create the configuration file in config/initializers/oai_config.rb

    The configuration options are as below

    OAI_CONFIG = {
      provider: {
        # repository_name: The name of the repository to be used by the OAI provider
        repository_name: 'The name of the repository',
    
        # repository_url: The base url of the repository providing the service
        repository_url: 'http://url_to_the_repository',
    
        # record_prefix: The oai provider expects a prefix. The usual value is oai
        record_prefix: 'oai',
    
        # admin_email: 1 or more admin emails as an array
        admin_email: ['email1@example.com', 'email2@example.com'],
    
        # sample_id: An example of a typical id of a record in your service.
        sample_id: 'repo:123'
      },
      document: {
        # model: The model class used for the document. The default is SolrDocument
        model: SolrDocument,
    
        # limit: The number of records or identifiers to be served in each request by the oai pmh service
        limit: 250,
    
        # set_class: The class used to define sets. The default is ::SetDetail
        set_class: '::SetDetail',
    
        # set_fields: The field or fields to be used to define sets
        set_fields: 'genre_ssim',
    
        set_filters: [
          # 0 or more query filters to filter out certain values from appearing in the sets
        ],
    
        record_filters: [
          # 0 or more query filters to filter records from being shown in
          #   ListIdentifiers, ListRecords, GetRecord and in aggregating values for ListSets
    
          # Here are an example set of filters
          # Example filter to limit access to public records
          'discover_access_group_ssim:public OR read_access_group_ssim:public',
          # Example filter to ignore the FileAsset model
          '-has_model_ssim:"info:fedora/afmodel:FileAsset"',
          # Example filter to ignore the ActiveFedora::Base active fedora model
          '-active_fedora_model_ssi:"ActiveFedora::Base"'
        ],
    
        format_filters: {
          # By default, the service assumes all records are available in all formats
          # If a particular format is available only for a subset of records,
          # use format_filters to define 0 or more query filters 
          #   to filter records from being shown in
          #   ListIdentifiers, ListRecords, GetRecord and in aggregating values for ListSets
          #   for the defined format
    
          # For example, for the uketd_dc format, only show records that belong to the genre
          #   "Thesis or dissertation"
          'uketd_dc': ['genre_ssim:"Thesis or dissertation"'],
        },
    
        # timestamp_field: The fields to be used to run timestamp queries against
        timestamp_field: 'system_modified_dtsi',
    
        # timestamp_method: The method defined in the SolrDocument model, that processes the timestamp if needed.
        #   The default method is create_date
        timestamp_method: 'create_date',
    
        # supported_formats: The list of formtats supported by the oai pmh service
        supported_formats: ['oai_dc', 'mods', 'uketd_dc']
      }
    }
    
    The "provider" configuration is documented as part of the ruby-oai gem at http://oai.rubyforge.org/

    The current configuration file is here