Class: TheShoveler::Targets::Solr
- Inherits:
-
TheShoveler::Target
- Object
- TheShoveler::Target
- TheShoveler::Targets::Solr
- Defined in:
- lib/theShoveler/targets/solr.rb
Instance Attribute Summary collapse
-
#starting_id ⇒ Object
Returns the value of attribute starting_id.
Attributes inherited from TheShoveler::Target
Instance Method Summary collapse
- #add(document) ⇒ Object
-
#initialize(connection_info) ⇒ Solr
constructor
A new instance of Solr.
Constructor Details
#initialize(connection_info) ⇒ Solr
Returns a new instance of Solr.
6 7 8 9 10 |
# File 'lib/theShoveler/targets/solr.rb', line 6 def initialize(connection_info) super(connection_info) @starting_id ||= 0 @solr = RSolr.connect url: connection_info[:url] end |
Instance Attribute Details
#starting_id ⇒ Object
Returns the value of attribute starting_id.
5 6 7 |
# File 'lib/theShoveler/targets/solr.rb', line 5 def starting_id @starting_id end |
Instance Method Details
#add(document) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/theShoveler/targets/solr.rb', line 12 def add(document) super(document) unless document.doc_attributes[:id] document.doc_attributes[:id] = @starting_id @starting_id += 1 end return @solr.add document.doc_attributes end |