class TheShoveler::Targets::Solr

Attributes

starting_id[RW]

Public Class Methods

new(connection_info) click to toggle source
Calls superclass method TheShoveler::Target::new
# 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

Public Instance Methods

add(document) click to toggle source
Calls superclass method TheShoveler::Target#add
# 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