Class: ThinkingSphinx::Index

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reference, options, &block) ⇒ Index

Returns a new instance of Index



10
11
12
13
14
15
16
# File 'lib/thinking_sphinx/index.rb', line 10

def initialize(reference, options, &block)
  defaults = ThinkingSphinx::Configuration.instance.
    settings['index_options'] || {}
  defaults.symbolize_keys!
  
  @reference, @options, @block = reference, defaults.merge(options), block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block



2
3
4
# File 'lib/thinking_sphinx/index.rb', line 2

def block
  @block
end

#optionsObject (readonly)

Returns the value of attribute options



2
3
4
# File 'lib/thinking_sphinx/index.rb', line 2

def options
  @options
end

#referenceObject (readonly)

Returns the value of attribute reference



2
3
4
# File 'lib/thinking_sphinx/index.rb', line 2

def reference
  @reference
end

Class Method Details

.define(reference, options = {}, &block) ⇒ Object



4
5
6
7
8
# File 'lib/thinking_sphinx/index.rb', line 4

def self.define(reference, options = {}, &block)
  new(reference, options, &block).indices.each do |index|
    ThinkingSphinx::Configuration.instance.indices << index
  end
end

Instance Method Details

#indicesObject



18
19
20
21
22
23
24
# File 'lib/thinking_sphinx/index.rb', line 18

def indices
  if options[:delta]
    delta_indices
  else
    [single_index]
  end
end