Skip to content

Instantly share code, notes, and snippets.

@jsqu99
Created April 18, 2013 00:36
Show Gist options
  • Save jsqu99/5408936 to your computer and use it in GitHub Desktop.
Save jsqu99/5408936 to your computer and use it in GitHub Desktop.
with(:price, Range.new(price.split('-').first, price.split('-').last)) if price
# see https://github.com/sunspot/sunspot#readme for a good explanation of using 'row' with facets
facet(:price) do
PRODUCT_PRICE_RANGES.each do |range|
row(range) do
Rails.logger.debug("adding price facet w/ range: #{range.split('-').first}, #{range.split('-').last}")
with(:price, Range.new(range.split('-').first, range.split('-').last))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment