Sha256: 053c97000f6b5fa2fb832c683cd6dd6ac334f56fa5a6e40576db8a2127116a5a

Contents?: true

Size: 1009 Bytes

Versions: 22

Compression:

Stored size: 1009 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] id document's unique key value
    # @param [Hash] params additional query parameters
    def find(id, params = {})
      raise NotImplementedError
    end

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

    protected

      def connection_config
        blacklight_config.connection_config
      end

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
blacklight-6.18.0 lib/blacklight/abstract_repository.rb
blacklight-6.17.0 lib/blacklight/abstract_repository.rb
blacklight-6.16.0 lib/blacklight/abstract_repository.rb
blacklight-6.15.0 lib/blacklight/abstract_repository.rb
blacklight-6.14.1 lib/blacklight/abstract_repository.rb
blacklight-6.14.0 lib/blacklight/abstract_repository.rb
blacklight-6.13.0 lib/blacklight/abstract_repository.rb
blacklight-6.12.0 lib/blacklight/abstract_repository.rb
blacklight-6.11.2 lib/blacklight/abstract_repository.rb
blacklight-6.11.1 lib/blacklight/abstract_repository.rb
blacklight-6.11.0 lib/blacklight/abstract_repository.rb
blacklight-6.10.1 lib/blacklight/abstract_repository.rb
blacklight-6.10.0 lib/blacklight/abstract_repository.rb
blacklight-6.9.0 lib/blacklight/abstract_repository.rb
blacklight-6.8.0 lib/blacklight/abstract_repository.rb
blacklight-6.7.3 lib/blacklight/abstract_repository.rb
blacklight-6.7.2 lib/blacklight/abstract_repository.rb
blacklight-6.7.1 lib/blacklight/abstract_repository.rb
blacklight-6.7.0 lib/blacklight/abstract_repository.rb
blacklight-6.6.2 lib/blacklight/abstract_repository.rb