Class: ThinkingSphinx::Distributed::Index

Inherits:
Riddle::Configuration::DistributedIndex
  • Object
show all
Defined in:
lib/thinking_sphinx/distributed/index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reference) ⇒ Index

Returns a new instance of Index.



8
9
10
11
12
13
14
# File 'lib/thinking_sphinx/distributed/index.rb', line 8

def initialize(reference)
  @reference           = reference
  @options             = {}
  @local_index_objects = []

  super reference.to_s.gsub('/', '_')
end

Instance Attribute Details

#local_index_objectsObject

Returns the value of attribute local_index_objects.



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

def local_index_objects
  @local_index_objects
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

#referenceObject (readonly)

Returns the value of attribute reference.



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

def reference
  @reference
end

Instance Method Details

#delta?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/thinking_sphinx/distributed/index.rb', line 16

def delta?
  false
end

#distributed?Boolean

Returns:

  • (Boolean)


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

def distributed?
  true
end

#facetsObject



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

def facets
  local_index_objects.collect(&:facets).flatten
end

#modelObject



33
34
35
# File 'lib/thinking_sphinx/distributed/index.rb', line 33

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

#primary_keyObject



37
38
39
# File 'lib/thinking_sphinx/distributed/index.rb', line 37

def primary_key
  @primary_key ||= configuration.settings['primary_key'] || :id
end