class ThinkingSphinx::RealTime::Populator
Attributes
index[R]
started_at[R]
Public Class Methods
new(index)
click to toggle source
# File lib/thinking_sphinx/real_time/populator.rb, line 8 def initialize(index) @index = index @started_at = Time.current end
populate(index)
click to toggle source
# File lib/thinking_sphinx/real_time/populator.rb, line 4 def self.populate(index) new(index).populate end
Public Instance Methods
populate()
click to toggle source
# File lib/thinking_sphinx/real_time/populator.rb, line 13 def populate instrument 'start_populating' scope.find_in_batches(:batch_size => batch_size) do |instances| transcriber.copy *instances instrument 'populated', :instances => instances end transcriber.clear_before(started_at) if configuration.settings["real_time_tidy"] instrument 'finish_populating' end
Private Instance Methods
configuration()
click to toggle source
# File lib/thinking_sphinx/real_time/populator.rb, line 33 def configuration ThinkingSphinx::Configuration.instance end
instrument(message, options = {})
click to toggle source
# File lib/thinking_sphinx/real_time/populator.rb, line 37 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 43 def transcriber @transcriber ||= ThinkingSphinx::RealTime::Transcriber.new index end