class Blacklight::AbstractRepository
Base class for Blacklight
repository adapters
Attributes
blacklight_config[RW]
@return [Blacklight::Configuration]
connection[W]
Direct writer for the connection
logger[W]
(Note: ActiveSupport::Benchmarkable requires a logger method) @return [Logger]
Public Class Methods
new(blacklight_config)
click to toggle source
@param [Blacklight::Configuration] blacklight_config
# File lib/blacklight/abstract_repository.rb, line 20 def initialize blacklight_config @blacklight_config = blacklight_config end
Public Instance Methods
connection()
click to toggle source
The raw data store connection
# File lib/blacklight/abstract_repository.rb, line 26 def connection @connection ||= build_connection end
find(_id, _params = {})
click to toggle source
Find a single document result by a known id @param [String] _id document’s unique key value @param [Hash] _params additional query parameters
# File lib/blacklight/abstract_repository.rb, line 34 def find(_id, _params = {}) raise NotImplementedError end
find_many(params, **kwargs)
click to toggle source
Find multiple documents by their ids @param [Hash] _params query parameters
# File lib/blacklight/abstract_repository.rb, line 40 def find_many(params, **kwargs) search(params, **kwargs) end
ping()
click to toggle source
Is the repository in a working state?
# File lib/blacklight/abstract_repository.rb, line 59 def ping raise NotImplementedError end
reflect_fields()
click to toggle source
Query the fields that exist from the index @return [Hash]
# File lib/blacklight/abstract_repository.rb, line 53 def reflect_fields raise NotImplementedError end
search(_params = {})
click to toggle source
Execute a search query against a search index @param [Hash] _params query parameters
# File lib/blacklight/abstract_repository.rb, line 47 def search(_params = {}) raise NotImplementedError end
Private Instance Methods
connection_config()
click to toggle source
# File lib/blacklight/abstract_repository.rb, line 65 def connection_config blacklight_config.connection_config end
logger()
click to toggle source
# File lib/blacklight/abstract_repository.rb, line 69 def logger @logger ||= Blacklight.logger end