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 6 def initialize(reference, options = {}) @fields = [] @attributes = [] @conditions = [] Template.new(self).apply super reference, options end
Public Instance Methods
add_attribute(attribute)
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 16 def add_attribute(attribute) @attributes << attribute end
add_field(field)
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 20 def add_field(field) @fields << field end
attributes()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 24 def attributes interpret_definition! @attributes end
conditions()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 30 def conditions interpret_definition! @conditions end
facets()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 36 def facets properties.select(&:facet?) end
fields()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 40 def fields interpret_definition! @fields end
scope()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 46 def scope @scope.nil? ? model : @scope.call end
unique_attribute_names()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 50 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 56 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 60 def collection_for(attribute) case attribute.type when :integer, :boolean attribute.multi? ? @rt_attr_multi : @rt_attr_uint when :string @rt_attr_string when :timestamp @rt_attr_timestamp when :float @rt_attr_float when :bigint attribute.multi? ? @rt_attr_multi_64 : @rt_attr_bigint else raise "Unknown attribute type '#{attribute.type}'" end end
interpreter()
click to toggle source
# File lib/thinking_sphinx/real_time/index.rb, line 77 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 81 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 91 def properties fields + attributes end