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)


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

def delta?
  false
end

#distributed?Boolean

Returns:

  • (Boolean)


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

def distributed?
  false
end

#document_id_for_key(key) ⇒ Object



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

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
19
# File 'lib/thinking_sphinx/core/index.rb', line 10

def initialize(reference, options = {})
  @reference    = reference.to_sym
  @docinfo      = :extern
  @charset_type = 'utf-8'
  @options      = options
  @offset       = config.next_offset(reference)
  @type         = 'plain'

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

#interpret_definition!Object



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

def interpret_definition!
  return if @interpreted_definition

  apply_defaults!

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

#modelObject



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

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

#optionsObject



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

def options
  interpret_definition!
  @options
end

#renderObject



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

def render
  pre_render
  set_path

  assign_infix_fields
  assign_prefix_fields

  super
end