Class: Valkyrie::Persistence::Solr::MetadataAdapter
- Inherits:
-
Object
- Object
- Valkyrie::Persistence::Solr::MetadataAdapter
- Defined in:
- lib/valkyrie/persistence/solr/metadata_adapter.rb
Overview
MetadataAdapter for Solr Adapter.
This adapter persists resources as hashes to an RSolr connection.
Defined Under Namespace
Classes: NullIndexer
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#resource_indexer ⇒ Object
readonly
Returns the value of attribute resource_indexer.
-
#write_only ⇒ Object
readonly
Returns the value of attribute write_only.
Instance Method Summary collapse
-
#id ⇒ Valkyrie::ID
Generate the Valkyrie ID for this unique metadata adapter This uses the URL of the Solr endpoint to ensure that this is unique.
-
#initialize(connection:, resource_indexer: NullIndexer, write_only: false, soft_commit: true) ⇒ MetadataAdapter
constructor
A new instance of MetadataAdapter.
-
#persister ⇒ Valkyrie::Persistence::Solr::Persister
The solr persister.
-
#query_service ⇒ Valkyrie::Persistence::Solr::QueryService
The solr query service.
-
#resource_factory ⇒ Valkyrie::Persistence::Solr::ResourceFactory
A resource factory to convert a resource to a solr document and back.
- #soft_commit? ⇒ Boolean
- #write_only? ⇒ Boolean
Constructor Details
#initialize(connection:, resource_indexer: NullIndexer, write_only: false, soft_commit: true) ⇒ MetadataAdapter
Returns a new instance of MetadataAdapter.
36 37 38 39 40 41 |
# File 'lib/valkyrie/persistence/solr/metadata_adapter.rb', line 36 def initialize(connection:, resource_indexer: NullIndexer, write_only: false, soft_commit: true) @connection = connection @resource_indexer = resource_indexer @write_only = write_only @soft_commit = soft_commit end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
30 31 32 |
# File 'lib/valkyrie/persistence/solr/metadata_adapter.rb', line 30 def connection @connection end |
#resource_indexer ⇒ Object (readonly)
Returns the value of attribute resource_indexer.
30 31 32 |
# File 'lib/valkyrie/persistence/solr/metadata_adapter.rb', line 30 def resource_indexer @resource_indexer end |
#write_only ⇒ Object (readonly)
Returns the value of attribute write_only.
30 31 32 |
# File 'lib/valkyrie/persistence/solr/metadata_adapter.rb', line 30 def write_only @write_only end |
Instance Method Details
#id ⇒ Valkyrie::ID
Generate the Valkyrie ID for this unique metadata adapter This uses the URL of the Solr endpoint to ensure that this is unique
69 70 71 |
# File 'lib/valkyrie/persistence/solr/metadata_adapter.rb', line 69 def id @id ||= Valkyrie::ID.new(Digest::MD5.hexdigest(connection.base_uri.to_s)) end |
#persister ⇒ Valkyrie::Persistence::Solr::Persister
Returns The solr persister.
44 45 46 |
# File 'lib/valkyrie/persistence/solr/metadata_adapter.rb', line 44 def persister @persister ||= Valkyrie::Persistence::Solr::Persister.new(adapter: self) end |
#query_service ⇒ Valkyrie::Persistence::Solr::QueryService
Returns The solr query service.
58 59 60 61 62 63 64 |
# File 'lib/valkyrie/persistence/solr/metadata_adapter.rb', line 58 def query_service @query_service ||= Valkyrie::Persistence::Solr::QueryService.new( connection: connection, resource_factory: resource_factory, adapter: self ) end |
#resource_factory ⇒ Valkyrie::Persistence::Solr::ResourceFactory
Returns A resource factory to convert a resource to a solr document and back.
75 76 77 |
# File 'lib/valkyrie/persistence/solr/metadata_adapter.rb', line 75 def resource_factory Valkyrie::Persistence::Solr::ResourceFactory.new(resource_indexer: resource_indexer, adapter: self) end |
#soft_commit? ⇒ Boolean
52 53 54 |
# File 'lib/valkyrie/persistence/solr/metadata_adapter.rb', line 52 def soft_commit? @soft_commit end |
#write_only? ⇒ Boolean
48 49 50 |
# File 'lib/valkyrie/persistence/solr/metadata_adapter.rb', line 48 def write_only? write_only end |