Sha256: 8c365e93156d7ec125a0105260db9d7c2c9cefcd9534a65a8c768d8d50b53c51

Contents?: true

Size: 710 Bytes

Versions: 17

Compression:

Stored size: 710 Bytes

Contents

# frozen_string_literal: true

class ThinkingSphinx::Configuration::ConsistentIds
  def initialize(indices)
    @indices = indices
  end

  def reconcile
    return unless sphinx_internal_ids.any? { |attribute|
      attribute.type == :bigint
    }

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

  private

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

  def sphinx_internal_ids
    @sphinx_internal_ids ||= attributes.select { |attribute|
      attribute.name == 'sphinx_internal_id'
    }
  end

  def sources
    @sources ||= @indices.select { |index|
      index.respond_to?(:sources)
    }.collect(&:sources).flatten
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-5.5.1 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-5.5.0 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-5.4.0 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-5.3.0 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-5.2.1 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-5.2.0 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-5.1.0 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-5.0.0 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-4.4.1 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-4.4.0 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-4.3.2 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-4.3.1 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-4.3.0 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-4.2.0 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-4.1.0 lib/thinking_sphinx/configuration/consistent_ids.rb
thinking-sphinx-4.0.0 lib/thinking_sphinx/configuration/consistent_ids.rb