Sha256: eae0b595479e2591f422b709cb6c888f1b258b8b82f85ee33d846e39a6034f37

Contents?: true

Size: 1.47 KB

Versions: 52

Compression:

Stored size: 1.47 KB

Contents

# frozen_string_literal: true
module Blacklight
  # Base class for Blacklight repository adapters
  class AbstractRepository
    # @return [Blacklight::Configuration]
    attr_accessor :blacklight_config

    # Direct writer for the connection
    attr_writer :connection

    # (Note: ActiveSupport::Benchmarkable requires a logger method)
    # @return [Logger]
    attr_writer :logger

    include ActiveSupport::Benchmarkable

    ##
    # @param [Blacklight::Configuration] blacklight_config
    def initialize blacklight_config
      @blacklight_config = blacklight_config
    end

    ##
    # The raw data store connection
    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

    # Query the fields that exist from the index
    # @return [Hash]
    def reflect_fields
      raise NotImplementedError
    end

    ##
    # Is the repository in a working state?
    def ping
      raise NotImplementedError
    end

    private

    def connection_config
      blacklight_config.connection_config
    end

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

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/lib/blacklight/abstract_repository.rb
blacklight-7.37.0 lib/blacklight/abstract_repository.rb
blacklight-7.36.2 lib/blacklight/abstract_repository.rb
blacklight-7.36.1 lib/blacklight/abstract_repository.rb
blacklight-7.36.0 lib/blacklight/abstract_repository.rb
blacklight-7.35.0 lib/blacklight/abstract_repository.rb
blacklight-7.34.0 lib/blacklight/abstract_repository.rb
blacklight-7.33.1 lib/blacklight/abstract_repository.rb
blacklight-7.33.0 lib/blacklight/abstract_repository.rb
blacklight-7.32.0 lib/blacklight/abstract_repository.rb
blacklight-7.31.0 lib/blacklight/abstract_repository.rb
blacklight-7.30.0 lib/blacklight/abstract_repository.rb
blacklight-7.29.0 lib/blacklight/abstract_repository.rb
blacklight-7.28.0 lib/blacklight/abstract_repository.rb
blacklight-7.27.1 lib/blacklight/abstract_repository.rb
blacklight-7.27.0 lib/blacklight/abstract_repository.rb
blacklight-7.26.1 lib/blacklight/abstract_repository.rb
blacklight-7.26.0 lib/blacklight/abstract_repository.rb
blacklight-7.25.3 lib/blacklight/abstract_repository.rb
blacklight-7.25.2 lib/blacklight/abstract_repository.rb