Class: ThinkingSphinx::RealTime::Interpreter

Inherits:
Core::Interpreter show all
Defined in:
lib/thinking_sphinx/real_time/interpreter.rb

Instance Method Summary collapse

Methods inherited from Core::Interpreter

#initialize, translate!

Constructor Details

This class inherits a constructor from ThinkingSphinx::Core::Interpreter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ThinkingSphinx::Core::Interpreter

Instance Method Details

#has(*columns) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/thinking_sphinx/real_time/interpreter.rb', line 6

def has(*columns)
  options = columns.extract_options!

  columns.collect { |column|
    ::ThinkingSphinx::RealTime::Attribute.new column, options
  }.each { |attribute| @index.add_attribute attribute }
end

#indexes(*columns) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/thinking_sphinx/real_time/interpreter.rb', line 14

def indexes(*columns)
  options = columns.extract_options!

  columns.collect { |column|
    ::ThinkingSphinx::RealTime::Field.new column, options
  }.each { |field| @index.add_field field }

  append_sortable_attributes columns, options if options[:sortable]
end

#scope(&block) ⇒ Object



24
25
26
# File 'lib/thinking_sphinx/real_time/interpreter.rb', line 24

def scope(&block)
  @index.scope = block
end

#set_property(properties) ⇒ Object



28
29
30
31
32
33
# File 'lib/thinking_sphinx/real_time/interpreter.rb', line 28

def set_property(properties)
  properties.each do |key, value|
    @index.send("#{key}=", value) if @index.class.settings.include?(key)
    @index.options[key] = value   if search_option?(key)
  end
end

#where(condition) ⇒ Object



35
36
37
# File 'lib/thinking_sphinx/real_time/interpreter.rb', line 35

def where(condition)
  @index.conditions << condition
end