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.
19 20 21 |
# File 'lib/blacklight/abstract_repository.rb', line 19 def initialize blacklight_config @blacklight_config = blacklight_config end |
Instance Attribute Details
#blacklight_config ⇒ Blacklight::Configuration
6 7 8 |
# File 'lib/blacklight/abstract_repository.rb', line 6 def blacklight_config @blacklight_config end |
#connection ⇒ Object
The raw data store connection
25 26 27 |
# File 'lib/blacklight/abstract_repository.rb', line 25 def connection @connection ||= build_connection end |
#logger=(value) ⇒ Logger
(Note: ActiveSupport::Benchmarkable requires a logger method)
13 14 15 |
# File 'lib/blacklight/abstract_repository.rb', line 13 def logger=(value) @logger = value end |
Instance Method Details
#find(_id, _params = {}) ⇒ Object
Find a single document result by a known id
33 34 35 |
# File 'lib/blacklight/abstract_repository.rb', line 33 def find(_id, _params = {}) raise NotImplementedError end |
#find_many(params, **kwargs) ⇒ Object
Find multiple documents by their ids
39 40 41 |
# File 'lib/blacklight/abstract_repository.rb', line 39 def find_many(params, **kwargs) search(params, **kwargs) end |
#ping ⇒ Object
Is the repository in a working state?
58 59 60 |
# File 'lib/blacklight/abstract_repository.rb', line 58 def ping raise NotImplementedError end |
#reflect_fields ⇒ Hash
Query the fields that exist from the index
52 53 54 |
# File 'lib/blacklight/abstract_repository.rb', line 52 def reflect_fields raise NotImplementedError end |
#search(_params = {}) ⇒ Object
Execute a search query against a search index
46 47 48 |
# File 'lib/blacklight/abstract_repository.rb', line 46 def search(_params = {}) raise NotImplementedError end |