Sha256: bf3f5e30ccd28a2859d00e62810278a41d178d593bf14cf22ad22385f993aa3f

Contents?: true

Size: 959 Bytes

Versions: 8

Compression:

Stored size: 959 Bytes

Contents

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

8 entries across 8 versions & 1 rubygems

Version Path
blacklight-5.19.2 lib/blacklight/abstract_repository.rb
blacklight-5.19.1 lib/blacklight/abstract_repository.rb
blacklight-5.19.0 lib/blacklight/abstract_repository.rb
blacklight-5.18.0 lib/blacklight/abstract_repository.rb
blacklight-5.17.2 lib/blacklight/abstract_repository.rb
blacklight-6.0.0.pre5 lib/blacklight/abstract_repository.rb
blacklight-5.17.1 lib/blacklight/abstract_repository.rb
blacklight-5.17.0 lib/blacklight/abstract_repository.rb