Class: Blacklight::AbstractRepository
- Inherits:
-
Object
- Object
- Blacklight::AbstractRepository
- Includes:
- ActiveSupport::Benchmarkable
- Defined in:
- lib/blacklight/abstract_repository.rb
Overview
Base class for Blacklight repository adapters
Direct Known Subclasses
Instance Attribute Summary collapse
- #blacklight_config ⇒ Blacklight::Configuration
-
#connection ⇒ Object
The raw data store connection.
-
#logger ⇒ Logger
writeonly
(Note: ActiveSupport::Benchmarkable requires a logger method).
Instance Method Summary collapse
-
#find(_id, _params = {}) ⇒ Object
Find a single document result by a known id.
-
#find_many(params, **kwargs) ⇒ Object
Find multiple documents by their ids.
-
#initialize(blacklight_config) ⇒ AbstractRepository
constructor
A new instance of AbstractRepository.
-
#ping ⇒ Object
Is the repository in a working state?.
-
#reflect_fields ⇒ Hash
Query the fields that exist from the index.
-
#search(_params = {}) ⇒ Object
Execute a search query against a search index.
Constructor Details
#initialize(blacklight_config) ⇒ AbstractRepository
Returns a new instance of AbstractRepository.
20 21 22 |
# File 'lib/blacklight/abstract_repository.rb', line 20 def initialize blacklight_config @blacklight_config = blacklight_config end |
Instance Attribute Details
#blacklight_config ⇒ Blacklight::Configuration
7 8 9 |
# File 'lib/blacklight/abstract_repository.rb', line 7 def blacklight_config @blacklight_config end |
#connection ⇒ Object
The raw data store connection
26 27 28 |
# File 'lib/blacklight/abstract_repository.rb', line 26 def connection @connection ||= build_connection end |
#logger=(value) ⇒ Logger
(Note: ActiveSupport::Benchmarkable requires a logger method)
14 15 16 |
# File 'lib/blacklight/abstract_repository.rb', line 14 def logger=(value) @logger = value end |
Instance Method Details
#find(_id, _params = {}) ⇒ Object
Find a single document result by a known id
34 35 36 |
# File 'lib/blacklight/abstract_repository.rb', line 34 def find(_id, _params = {}) raise NotImplementedError end |
#find_many(params, **kwargs) ⇒ Object
Find multiple documents by their ids
40 41 42 |
# File 'lib/blacklight/abstract_repository.rb', line 40 def find_many(params, **kwargs) search(params, **kwargs) end |
#ping ⇒ Object
Is the repository in a working state?
59 60 61 |
# File 'lib/blacklight/abstract_repository.rb', line 59 def ping raise NotImplementedError end |
#reflect_fields ⇒ Hash
Query the fields that exist from the index
53 54 55 |
# File 'lib/blacklight/abstract_repository.rb', line 53 def reflect_fields raise NotImplementedError end |
#search(_params = {}) ⇒ Object
Execute a search query against a search index
47 48 49 |
# File 'lib/blacklight/abstract_repository.rb', line 47 def search(_params = {}) raise NotImplementedError end |