Class: ThinkingSphinx::FacetSearch::Filter

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

Instance Method Summary collapse

Constructor Details

#initialize(facets, hash) ⇒ Filter

Returns a new instance of Filter.



128
129
130
# File 'lib/thinking_sphinx/facet_search.rb', line 128

def initialize(facets, hash)
  @facets, @hash = facets, hash
end

Instance Method Details

#to_hashObject



132
133
134
135
136
137
138
139
# File 'lib/thinking_sphinx/facet_search.rb', line 132

def to_hash
  @hash.keys.inject({}) { |options, key|
    type = @facets.detect { |facet| facet.name == key.to_s }.filter_type
    options[type] ||= {}
    options[type][key] = @hash[key]
    options
  }
end