Sha256: 8317090e4bc9b5f87c1b0b9d8bea1739d4153cb9c294d5846248b98f5ded26b1

Contents?: true

Size: 989 Bytes

Versions: 3

Compression:

Stored size: 989 Bytes

Contents

# frozen_string_literal: true
module Blacklight
  class AbstractRepository
    attr_accessor :blacklight_config
    attr_writer :connection

    # ActiveSupport::Benchmarkable requires a logger method
    attr_accessor :logger

    include ActiveSupport::Benchmarkable

    def initialize blacklight_config
      @blacklight_config = blacklight_config
    end

    def connection
      @connection ||= build_connection
    end

    ##
    # Find a single document result by a known id
    # @param [String] document's unique key value
    # @param [Hash] additional query parameters
    def find(id, params = {})
      fail NotImplementedError
    end

    ##
    # Execute a search query against a search index
    # @param [Hash] query parameters
    def search(params = {})
      fail NotImplementedError
    end

    protected
      def connection_config
        blacklight_config.connection_config
      end

      def logger
        @logger ||= Blacklight.logger
      end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight-6.0.2 lib/blacklight/abstract_repository.rb
blacklight-6.0.1 lib/blacklight/abstract_repository.rb
blacklight-6.0.0 lib/blacklight/abstract_repository.rb