module ThinkingSphinx::Core::Index

Public Class Methods

new(reference, options = {}) click to toggle source
Calls superclass method
# 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

Public Instance Methods

delta?() click to toggle source
# File lib/thinking_sphinx/core/index.rb, line 21
def delta?
  false
end
document_id_for_key(key) click to toggle source
# File lib/thinking_sphinx/core/index.rb, line 25
def document_id_for_key(key)
   key * config.indices.count + offset
end
interpret_definition!() click to toggle source
# File lib/thinking_sphinx/core/index.rb, line 29
def interpret_definition!
  return if @interpreted_definition

  apply_defaults!

  @interpreted_definition = true
  interpreter.translate! self, @definition_block if @definition_block
end
model() click to toggle source
# File lib/thinking_sphinx/core/index.rb, line 38
def model
  @model ||= reference.to_s.camelize.constantize
end
render() click to toggle source
Calls superclass method
# File lib/thinking_sphinx/core/index.rb, line 42
def render
  pre_render
  set_path

  assign_infix_fields
  assign_prefix_fields

  super
end

Private Instance Methods

assign_infix_fields() click to toggle source
# File lib/thinking_sphinx/core/index.rb, line 54
def assign_infix_fields
  self.infix_fields  = fields.select(&:infixing?).collect(&:name)
end
assign_prefix_fields() click to toggle source
# File lib/thinking_sphinx/core/index.rb, line 58
def assign_prefix_fields
  self.prefix_fields = fields.select(&:prefixing?).collect(&:name)
end
config() click to toggle source
# File lib/thinking_sphinx/core/index.rb, line 62
def config
  ThinkingSphinx::Configuration.instance
end
name_suffix() click to toggle source
# File lib/thinking_sphinx/core/index.rb, line 66
def name_suffix
  'core'
end
pre_render() click to toggle source
# File lib/thinking_sphinx/core/index.rb, line 70
def pre_render
  interpret_definition!
end
set_path() click to toggle source
# File lib/thinking_sphinx/core/index.rb, line 74
def set_path
  @path ||= File.join config.indices_location, name
end