Class: ThinkingSphinx::RealTime::Index

Inherits:
Riddle::Configuration::RealtimeIndex
  • Object
show all
Includes:
Core::Index
Defined in:
lib/thinking_sphinx/real_time/index.rb

Defined Under Namespace

Classes: Template

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::Index

#delta?, #distributed?, #document_id_for_key, #interpret_definition!, #model, #options, #render

Constructor Details

#initialize(reference, options = {}) ⇒ Index

Returns a new instance of Index



6
7
8
9
10
11
12
13
14
# 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

Instance Attribute Details

#attributesObject



24
25
26
27
28
# File 'lib/thinking_sphinx/real_time/index.rb', line 24

def attributes
  interpret_definition!

  @attributes
end

#conditionsObject



30
31
32
33
34
# File 'lib/thinking_sphinx/real_time/index.rb', line 30

def conditions
  interpret_definition!

  @conditions
end

#fieldsObject



40
41
42
43
44
# File 'lib/thinking_sphinx/real_time/index.rb', line 40

def fields
  interpret_definition!

  @fields
end

#scopeObject



46
47
48
# File 'lib/thinking_sphinx/real_time/index.rb', line 46

def scope
  @scope.nil? ? model : @scope.call
end

Instance Method Details

#add_attribute(attribute) ⇒ Object



16
17
18
# File 'lib/thinking_sphinx/real_time/index.rb', line 16

def add_attribute(attribute)
  @attributes << attribute
end

#add_field(field) ⇒ Object



20
21
22
# File 'lib/thinking_sphinx/real_time/index.rb', line 20

def add_field(field)
  @fields << field
end

#facetsObject



36
37
38
# File 'lib/thinking_sphinx/real_time/index.rb', line 36

def facets
  properties.select(&:facet?)
end

#unique_attribute_namesObject



50
51
52
# File 'lib/thinking_sphinx/real_time/index.rb', line 50

def unique_attribute_names
  attributes.collect(&:name)
end