Sha256: c5e6d8edd718dbe0bd083da2e53d59c00e8d5274e6860e1eccff60c5fa7a8c55

Contents?: true

Size: 855 Bytes

Versions: 14

Compression:

Stored size: 855 Bytes

Contents

# frozen_string_literal: true

class ThinkingSphinx::Distributed::Index <
  Riddle::Configuration::DistributedIndex

  attr_reader :reference, :options, :local_index_objects

  def initialize(reference)
    @reference           = reference
    @options             = {}
    @local_index_objects = []

    super reference.to_s.gsub('/', '_')
  end

  def delta?
    false
  end

  def distributed?
    true
  end

  def facets
    local_index_objects.collect(&:facets).flatten
  end

  def local_index_objects=(indices)
    self.local_indices = indices.collect(&:name)
    @local_index_objects = indices
  end

  def model
    @model ||= reference.to_s.camelize.constantize
  end

  def primary_key
    @primary_key ||= configuration.settings['primary_key'] || :id
  end

  private

  def configuration
    ThinkingSphinx::Configuration.instance
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-5.5.1 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-5.5.0 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-5.4.0 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-5.3.0 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-5.2.1 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-5.2.0 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-5.1.0 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-5.0.0 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-4.4.1 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-4.4.0 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-4.3.2 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-4.3.1 lib/thinking_sphinx/distributed/index.rb
thinking-sphinx-4.3.0 lib/thinking_sphinx/distributed/index.rb