Hi Matt What you're after is something like this:
has "IF(price > 0.0, 0, 1)", :as => :free, :type => :boolean This should work in MySQL, I'm not sure if PostgreSQL's IF statement follows the same syntax. Cheers -- Pat On 20/08/2010, at 5:18 AM, crazy_matt wrote: > I remember seeing somewhere an example of creating a Sphinx attribute > using an IF() function. The function basically used comparative > operators on numbers in the database so that the Sphinx index just > contained a boolean true/false value for faceting. I can't seem to > find it anywhere so I'm hoping someone here can enlighten me. > > What I want to do is facet on FREE vs. PAID and I want to use the > decimal "price" field in my database. Any ideas how I would set that > up in define_index? > > -- > 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. > -- 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.
