Class: CDMBL::DefaultSolr
- Inherits:
-
Object
- Object
- CDMBL::DefaultSolr
- Defined in:
- lib/cdmbl/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/core-here', client: RSolr) ⇒ DefaultSolr
constructor
A new instance of DefaultSolr.
Constructor Details
#initialize(url: 'http://localhost:8983/solr/core-here', client: RSolr) ⇒ DefaultSolr
7 8 9 10 |
# File 'lib/cdmbl/default_solr.rb', line 7 def initialize(url: 'http://localhost:8983/solr/core-here', client: RSolr) @url = url @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/cdmbl/default_solr.rb', line 6 def client @client end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/cdmbl/default_solr.rb', line 6 def url @url end |
Instance Method Details
#add(records) ⇒ Object
27 28 29 |
# File 'lib/cdmbl/default_solr.rb', line 27 def add(records) connection.add records end |
#connection ⇒ Object
23 24 25 |
# File 'lib/cdmbl/default_solr.rb', line 23 def connection @connection ||= client.connect url: url end |
#delete(ids) ⇒ Object
31 32 33 |
# File 'lib/cdmbl/default_solr.rb', line 31 def delete(ids) connection.delete_by_id ids end |
#ids(start: 0) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cdmbl/default_solr.rb', line 12 def ids(start: 0) connection.get('select', :params => { :q => '*:*', :defType => 'edismax', :fl => '', :rows => 10, :start => start } ) end |