Class: ThinkingSphinx::Search::Context

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(search, configuration = nil) ⇒ Context

Returns a new instance of Context.



6
7
8
9
10
11
12
13
14
# File 'lib/thinking_sphinx/search/context.rb', line 6

def initialize(search, configuration = nil)
  @search        = search
  @configuration = configuration || ThinkingSphinx::Configuration.instance
  @memory        = {
    :raw     => [],
    :results => [],
    :panes   => ThinkingSphinx::Configuration::Defaults::PANES.clone
  }
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



4
5
6
# File 'lib/thinking_sphinx/search/context.rb', line 4

def configuration
  @configuration
end

#searchObject (readonly)

Returns the value of attribute search.



4
5
6
# File 'lib/thinking_sphinx/search/context.rb', line 4

def search
  @search
end

Instance Method Details

#[](key) ⇒ Object



16
17
18
# File 'lib/thinking_sphinx/search/context.rb', line 16

def [](key)
  @memory[key]
end

#[]=(key, value) ⇒ Object



20
21
22
# File 'lib/thinking_sphinx/search/context.rb', line 20

def []=(key, value)
  @memory[key] = value
end

#marshal_dumpObject



24
25
26
# File 'lib/thinking_sphinx/search/context.rb', line 24

def marshal_dump
  [@memory.except(:raw, :indices)]
end

#marshal_load(array) ⇒ Object



28
29
30
# File 'lib/thinking_sphinx/search/context.rb', line 28

def marshal_load(array)
  @memory = array.first
end