class ThinkingSphinx::RealTime::Populator
Attributes
index[R]
Public Class Methods
new(index)
click to toggle source
# File lib/thinking_sphinx/real_time/populator.rb, line 6 def initialize(index) @index = index end
populate(index)
click to toggle source
# File lib/thinking_sphinx/real_time/populator.rb, line 2 def self.populate(index) new(index).populate end
Public Instance Methods
populate(&block)
click to toggle source
# File lib/thinking_sphinx/real_time/populator.rb, line 10 def populate(&block) instrument 'start_populating' scope.find_in_batches(:batch_size => batch_size) do |instances| transcriber.copy *instances instrument 'populated', :instances => instances end controller.rotate instrument 'finish_populating' end
Private Instance Methods
configuration()
click to toggle source
# File lib/thinking_sphinx/real_time/populator.rb, line 29 def configuration ThinkingSphinx::Configuration.instance end
instrument(message, options = {})
click to toggle source
# File lib/thinking_sphinx/real_time/populator.rb, line 33 def instrument(message, options = {}) ActiveSupport::Notifications.instrument( "#{message}.thinking_sphinx.real_time", options.merge(:index => index) ) end
transcriber()
click to toggle source
# File lib/thinking_sphinx/real_time/populator.rb, line 39 def transcriber @transcriber ||= ThinkingSphinx::RealTime::Transcriber.new index end