Class: ThinkingSphinx::Configuration::DuplicateNames

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/configuration/duplicate_names.rb

Instance Method Summary collapse

Constructor Details

#initialize(indices) ⇒ DuplicateNames

Returns a new instance of DuplicateNames.



4
5
6
# File 'lib/thinking_sphinx/configuration/duplicate_names.rb', line 4

def initialize(indices)
  @indices = indices
end

Instance Method Details

#reconcileObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/thinking_sphinx/configuration/duplicate_names.rb', line 8

def reconcile
  indices.each do |index|
    return if index.distributed?

    counts_for(index).each do |name, count|
      next if count <= 1

      raise ThinkingSphinx::DuplicateNameError,
        "Duplicate field/attribute name '#{name}' in index '#{index.name}'"
    end
  end
end