Class: ThinkingSphinx::ActiveRecord::Index

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::Index

#distributed?, #document_id_for_instance, #document_id_for_key, #initialize, #interpret_definition!, #model, #options, #primary_key, #render

Instance Attribute Details

#definition_block=(value) ⇒ Object (writeonly)

Sets the attribute definition_block

Parameters:

  • value

    the value to set the attribute definition_block to.



7
8
9
# File 'lib/thinking_sphinx/active_record/index.rb', line 7

def definition_block=(value)
  @definition_block = value
end

#referenceObject (readonly)

Returns the value of attribute reference.



6
7
8
# File 'lib/thinking_sphinx/active_record/index.rb', line 6

def reference
  @reference
end

Instance Method Details

#append_sourceObject



9
10
11
12
13
14
15
# File 'lib/thinking_sphinx/active_record/index.rb', line 9

def append_source
  ThinkingSphinx::ActiveRecord::SQLSource.new(
    model, source_options.merge(:position => sources.length)
  ).tap do |source|
    sources << source
  end
end

#attributesObject



17
18
19
# File 'lib/thinking_sphinx/active_record/index.rb', line 17

def attributes
  sources.collect(&:attributes).flatten
end

#delta?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/thinking_sphinx/active_record/index.rb', line 21

def delta?
  @options[:delta?]
end

#delta_processorObject



25
26
27
# File 'lib/thinking_sphinx/active_record/index.rb', line 25

def delta_processor
  @options[:delta_processor].try(:new, adapter, @options[:delta_options] || {})
end

#facetsObject



29
30
31
# File 'lib/thinking_sphinx/active_record/index.rb', line 29

def facets
  @facets ||= sources.collect(&:facets).flatten
end

#fieldsObject



33
34
35
# File 'lib/thinking_sphinx/active_record/index.rb', line 33

def fields
  sources.collect(&:fields).flatten
end

#sourcesObject



37
38
39
40
# File 'lib/thinking_sphinx/active_record/index.rb', line 37

def sources
  interpret_definition!
  super
end

#unique_attribute_namesObject



42
43
44
# File 'lib/thinking_sphinx/active_record/index.rb', line 42

def unique_attribute_names
  attributes.collect(&:name)
end