Class: ThinkingSphinx::FacetSearch::Filter

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

Instance Method Summary (collapse)

Constructor Details

- (Filter) initialize(facets, hash)



113
114
115
# File 'lib/thinking_sphinx/facet_search.rb', line 113

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

Instance Method Details

- (Object) to_hash



117
118
119
120
121
122
123
124
# File 'lib/thinking_sphinx/facet_search.rb', line 117

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