class ThinkingSphinx::RealTime::Interpreter
Public Instance Methods
has(*columns)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# File lib/thinking_sphinx/real_time/interpreter.rb, line 24 def scope(&block) @index.scope = block end
set_property(properties)
click to toggle source
# 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)
click to toggle source
# File lib/thinking_sphinx/real_time/interpreter.rb, line 35 def where(condition) @index.conditions << condition end
Private Instance Methods
append_sortable_attributes(columns, options)
click to toggle source
# File lib/thinking_sphinx/real_time/interpreter.rb, line 41 def append_sortable_attributes(columns, options) options = options.except(:sortable).merge(:type => :string) columns.collect { |column| aliased_name = options[:as] aliased_name ||= column.__name.to_sym if column.respond_to?(:__name) aliased_name ||= column options[:as] = "#{aliased_name}_sort".to_sym ::ThinkingSphinx::RealTime::Attribute.new column, options }.each { |attribute| @index.add_attribute attribute } end