Class: Blacklight::AbstractRepository

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Benchmarkable
Defined in:
lib/blacklight/abstract_repository.rb

Overview

Base class for Blacklight repository adapters

Direct Known Subclasses

Solr::Repository

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(blacklight_config) ⇒ AbstractRepository

Returns a new instance of AbstractRepository.

Parameters:



20
21
22
# File 'lib/blacklight/abstract_repository.rb', line 20

def initialize blacklight_config
  @blacklight_config = blacklight_config
end

Instance Attribute Details

#blacklight_configBlacklight::Configuration



7
8
9
# File 'lib/blacklight/abstract_repository.rb', line 7

def blacklight_config
  @blacklight_config
end

#connectionObject

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)

Returns:

  • (Logger)


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

Parameters:

  • _id (String)

    document’s unique key value

  • _params (Hash) (defaults to: {})

    additional query parameters

Raises:

  • (NotImplementedError)


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

Parameters:

  • _params (Hash)

    query parameters



40
41
42
# File 'lib/blacklight/abstract_repository.rb', line 40

def find_many(params, **kwargs)
  search(params, **kwargs)
end

#pingObject

Is the repository in a working state?

Raises:

  • (NotImplementedError)


59
60
61
# File 'lib/blacklight/abstract_repository.rb', line 59

def ping
  raise NotImplementedError
end

#reflect_fieldsHash

Query the fields that exist from the index

Returns:

  • (Hash)

Raises:

  • (NotImplementedError)


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

Parameters:

  • _params (Hash) (defaults to: {})

    query parameters

Raises:

  • (NotImplementedError)


47
48
49
# File 'lib/blacklight/abstract_repository.rb', line 47

def search(_params = {})
  raise NotImplementedError
end