Class: ThinkingSphinx::RealTime::Populator

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/real_time/populator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index) ⇒ Populator

Returns a new instance of Populator.



6
7
8
# File 'lib/thinking_sphinx/real_time/populator.rb', line 6

def initialize(index)
  @index = index
end

Class Method Details

.populate(index) ⇒ Object



2
3
4
# File 'lib/thinking_sphinx/real_time/populator.rb', line 2

def self.populate(index)
  new(index).populate
end

Instance Method Details

#populate(&block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/thinking_sphinx/real_time/populator.rb', line 10

def populate(&block)
  instrument 'start_populating'

  remove_files

  scope.find_each do |instance|
    transcriber.copy instance
    instrument 'populated', :instance => instance
  end

  controller.rotate
  instrument 'finish_populating'
end