class ThinkingSphinx::IndexSet
Attributes
classes[R]
configuration[R]
index_names[R]
Public Class Methods
new(classes, index_names, configuration = nil)
click to toggle source
# File lib/thinking_sphinx/index_set.rb, line 6 def initialize(classes, index_names, configuration = nil) @classes = classes || [] @index_names = index_names @configuration = configuration || ThinkingSphinx::Configuration.instance end
Public Instance Methods
ancestors()
click to toggle source
# File lib/thinking_sphinx/index_set.rb, line 12 def ancestors classes_and_ancestors - classes end
to_a()
click to toggle source
# File lib/thinking_sphinx/index_set.rb, line 16 def to_a indices end
Private Instance Methods
classes_and_ancestors()
click to toggle source
# File lib/thinking_sphinx/index_set.rb, line 24 def classes_and_ancestors @classes_and_ancestors ||= classes.collect { |model| model.ancestors.take_while { |klass| klass != ActiveRecord::Base }.select { |klass| klass.class == Class } }.flatten end
indices()
click to toggle source
# File lib/thinking_sphinx/index_set.rb, line 34 def indices configuration.preload_indices return configuration.indices.select { |index| index_names.include?(index.name) } if index_names && index_names.any? everything = classes.empty? ? configuration.indices : configuration.indices_for_references(*references) everything.reject &:distributed? end
references()
click to toggle source
# File lib/thinking_sphinx/index_set.rb, line 46 def references classes_and_ancestors.collect { |klass| klass.name.underscore.to_sym } end