class ThinkingSphinx::Configuration::ConsistentIds

Public Class Methods

new(indices) click to toggle source
# File lib/thinking_sphinx/configuration/consistent_ids.rb, line 2
def initialize(indices)
  @indices = indices
end

Public Instance Methods

reconcile() click to toggle source
# File lib/thinking_sphinx/configuration/consistent_ids.rb, line 6
def reconcile
  return unless sphinx_internal_ids.any? { |attribute|
    attribute.type == :bigint
  }

  sphinx_internal_ids.each do |attribute|
    attribute.type = :bigint
  end
end

Private Instance Methods

attributes() click to toggle source
# File lib/thinking_sphinx/configuration/consistent_ids.rb, line 18
def attributes
  @attributes = sources.collect(&:attributes).flatten
end
sources() click to toggle source
# File lib/thinking_sphinx/configuration/consistent_ids.rb, line 28
def sources
  @sources ||= @indices.select { |index|
    index.respond_to?(:sources)
  }.collect(&:sources).flatten
end
sphinx_internal_ids() click to toggle source
# File lib/thinking_sphinx/configuration/consistent_ids.rb, line 22
def sphinx_internal_ids
  @sphinx_internal_ids ||= attributes.select { |attribute|
    attribute.name == 'sphinx_internal_id'
  }
end