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

- (Facet) initialize(name, properties)



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

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

Instance Attribute Details

- (Object) name (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

- (Object) filter_type



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

def filter_type
  use_field? ? :conditions : :with
end

- (Object) results_from(raw)



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