Class: ThinkingSphinx::Facet

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, properties) ⇒ Facet

Returns a new instance of Facet.



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

def initialize(name, properties)
  @name, @properties = name, properties
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#filter_typeObject



10
11
12
# File 'lib/thinking_sphinx/facet.rb', line 10

def filter_type
  use_field? ? :conditions : :with
end

#results_from(raw) ⇒ Object



14
15
16
17
18
19
# File 'lib/thinking_sphinx/facet.rb', line 14

def results_from(raw)
  raw.inject({}) { |hash, row|
    hash[row[group_column]] = row["sphinx_internal_count"]
    hash
  }
end