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



120
121
122
# File 'lib/thinking_sphinx/facet_search.rb', line 120

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

Instance Method Details

#to_hashObject



124
125
126
127
128
129
130
131
# File 'lib/thinking_sphinx/facet_search.rb', line 124

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