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



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

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name



2
3
4
# File 'lib/thinking_sphinx/facet.rb', line 2

def name
  @name
end

Instance Method Details

#filter_typeObject



8
9
10
# File 'lib/thinking_sphinx/facet.rb', line 8

def filter_type
  use_field? ? :conditions : :with
end

#results_from(raw) ⇒ Object



12
13
14
15
16
17
# File 'lib/thinking_sphinx/facet.rb', line 12

def results_from(raw)
  raw.inject({}) { |hash, row|
    hash[row[group_column]] = row['@count']
    hash
  }
end