class ThinkingSphinx::RealTime::Index
Attributes
attributes[W]
conditions[W]
fields[W]
scope[W]
Public Class Methods
new(reference, options = {})
click to toggle source
Calls superclass method
ThinkingSphinx::Core::Index::new
# File lib/thinking_sphinx/real_time/index.rb, line 8 def initialize(reference, options = {}) @fields = [] @attributes = [] @conditions = [] super reference, options Template.new(self).apply end
Public Instance Methods
add_attribute(attribute)
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 18 def add_attribute(attribute) @attributes.delete_if { |existing| existing.name == attribute.name } @attributes << attribute end
add_field(field)
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 24 def add_field(field) @fields.delete_if { |existing| existing.name == field.name } @fields << field end
attributes()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 30 def attributes interpret_definition! @attributes end
conditions()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 36 def conditions interpret_definition! @conditions end
facets()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 42 def facets properties.select(&:facet?) end
fields()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 46 def fields interpret_definition! @fields end
scope()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 52 def scope @scope.nil? ? model : @scope.call end
unique_attribute_names()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 56 def unique_attribute_names attributes.collect(&:name) end
Private Instance Methods
append_unique_attribute(collection, attribute)
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 62 def append_unique_attribute(collection, attribute) collection << attribute.name unless collection.include?(attribute.name) end
collection_for(attribute)
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 66 def collection_for(attribute) case attribute.type when :integer, :boolean, :timestamp attribute.multi? ? @rt_attr_multi : @rt_attr_uint when :string @rt_attr_string when :float @rt_attr_float when :bigint attribute.multi? ? @rt_attr_multi_64 : @rt_attr_bigint when :json @rt_attr_json else raise "Unknown attribute type '#{attribute.type}'" end end
interpreter()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 83 def interpreter ThinkingSphinx::RealTime::Interpreter end
pre_render()
click to toggle source
Calls superclass method
ThinkingSphinx::Core::Index#pre_render
# File lib/thinking_sphinx/real_time/index.rb, line 87 def pre_render super @rt_field = fields.collect &:name attributes.each do |attribute| append_unique_attribute collection_for(attribute), attribute end end
properties()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 97 def properties fields + attributes end