Module: ThinkingSphinx::Core::Index

Extended by:
ActiveSupport::Concern
Includes:
Settings
Included in:
ActiveRecord::Index, RealTime::Index
Defined in:
lib/thinking_sphinx/core/index.rb

Instance Method Summary collapse

Instance Method Details

#delta?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/thinking_sphinx/core/index.rb', line 20

def delta?
  false
end

#distributed?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/thinking_sphinx/core/index.rb', line 24

def distributed?
  false
end

#document_id_for_key(key) ⇒ Object



28
29
30
# File 'lib/thinking_sphinx/core/index.rb', line 28

def document_id_for_key(key)
  key * config.indices.count + offset
end

#initialize(reference, options = {}) ⇒ Object



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

def initialize(reference, options = {})
  @reference    = reference.to_sym
  @docinfo      = :extern
  @options      = options
  @offset       = config.next_offset(options[:offset_as] || reference)
  @type         = 'plain'

  super "#{options[:name] || reference.to_s.gsub('/', '_')}_#{name_suffix}"
end

#interpret_definition!Object



32
33
34
35
36
37
38
39
# File 'lib/thinking_sphinx/core/index.rb', line 32

def interpret_definition!
  return if @interpreted_definition

  apply_defaults!

  @interpreted_definition = true
  interpreter.translate! self, @definition_block if @definition_block
end

#modelObject



41
42
43
# File 'lib/thinking_sphinx/core/index.rb', line 41

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

#optionsObject



45
46
47
48
# File 'lib/thinking_sphinx/core/index.rb', line 45

def options
  interpret_definition!
  @options
end

#renderObject



50
51
52
53
54
55
56
57
58
# File 'lib/thinking_sphinx/core/index.rb', line 50

def render
  pre_render
  set_path

  assign_infix_fields
  assign_prefix_fields

  super
end