Alan wrote:
> Does anyone have any insight into how to break down a set of items
> (that have prices) into ranged groups, i.e.
>
> < $20(5)
> $20-$50(3)
> $50-$100(6)
> >$100(3)
how about:
define_index do
..
has "IF(price <= 20, 1, 0)", :as => :under_20, :type => :boolean, :facet =>
true
has "IF(price <= 50 AND price > 20, 1, 0)", :as => :20_to_50, :type =>
:boolean, :facet => true
has "IF(price <= 100 AND price > 50, 1, 0)", :as => :50_to_100, :type =>
:boolean, :facet => true
has "IF(price > 100, 1, 0)", :as => :over_100, :type => :boolean, :facet =>
true
..
end
You can then get 'bucket' counts using a standard facet call.
-- James Healy <jimmy-at-deefa-dot-com> Thu, 30 Jul 2009 10:29:23 +1000
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---