Class: CDMDEXER::DefaultSolr
- Inherits:
-
Object
- Object
- CDMDEXER::DefaultSolr
- Defined in:
- lib/cdmdexer/default_solr.rb
Overview
Commnicate with Solr: add / delete stuff
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #add(records) ⇒ Object
- #connection ⇒ Object
- #delete(ids) ⇒ Object
- #ids(start: 0) ⇒ Object
-
#initialize(url = 'http://localhost:8983/solr/blacklight-core', client = RSolr) ⇒ DefaultSolr
constructor
A new instance of DefaultSolr.
Constructor Details
#initialize(url = 'http://localhost:8983/solr/blacklight-core', client = RSolr) ⇒ DefaultSolr
Returns a new instance of DefaultSolr.
10 11 12 13 |
# File 'lib/cdmdexer/default_solr.rb', line 10 def initialize(url = 'http://localhost:8983/solr/blacklight-core', client = RSolr) @url = ENV['SOLR_URL'] || url @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/cdmdexer/default_solr.rb', line 8 def client @client end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/cdmdexer/default_solr.rb', line 8 def url @url end |
Instance Method Details
#add(records) ⇒ Object
28 29 30 |
# File 'lib/cdmdexer/default_solr.rb', line 28 def add(records) connection.add records end |
#connection ⇒ Object
24 25 26 |
# File 'lib/cdmdexer/default_solr.rb', line 24 def connection @connection ||= client.connect url: @url end |
#delete(ids) ⇒ Object
32 33 34 |
# File 'lib/cdmdexer/default_solr.rb', line 32 def delete(ids) connection.delete_by_id ids end |
#ids(start: 0) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/cdmdexer/default_solr.rb', line 15 def ids(start: 0) connection.get('select', params: { q: '*:*', defType: 'edismax', fl: '', rows: 10, start: start }) end |