Class: ThinkingSphinx::RealTime::Transcriber
- Inherits:
-
Object
- Object
- ThinkingSphinx::RealTime::Transcriber
- Defined in:
- lib/thinking_sphinx/real_time/transcriber.rb
Instance Method Summary collapse
- #copy(instance) ⇒ Object
-
#initialize(index) ⇒ Transcriber
constructor
A new instance of Transcriber.
Constructor Details
#initialize(index) ⇒ Transcriber
Returns a new instance of Transcriber.
2 3 4 |
# File 'lib/thinking_sphinx/real_time/transcriber.rb', line 2 def initialize(index) @index = index end |
Instance Method Details
#copy(instance) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/thinking_sphinx/real_time/transcriber.rb', line 6 def copy(instance) return unless copy? instance columns, values = ['id'], [index.document_id_for_key(instance.id)] (index.fields + index.attributes).each do |property| columns << property.name values << property.translate(instance) end sphinxql = Riddle::Query::Insert.new index.name, columns, values ThinkingSphinx::Connection.take do |connection| connection.execute sphinxql.replace!.to_sql end end |