Hi Jim
I'm not sure of your familiarity with Sphinx, so bear with me if I'm
explaining the obvious.
Sphinx can do OR filters on fields (string data), but it can't on
attributes (ints, datetimes, floats, booleans). And you're mixing the
two, so that makes it doubly tricky.
What you could do, is create a custom attribute soemthing like the
following in your define_index block:
has "IF(aasm_state = 'basic', #{0xFFFFFFFF}, expires_at)", :as
=> :enhanced_expire, :type => :integer
And then you could filter as follows:
Model.search :with => {:enhanced_expire => Time.now.to_i..0xFFFFFFFF}
This is all a bit of guesswork, mind you, but hopefully it - or
something similar - should work.
Cheers
--
Pat
On 03/03/2009, at 2:07 AM, Jim Neath wrote:
>
> I'm basically trying to achieve the following with TS:
>
> WHERE aasm_state = 'basic' OR (aasm_state = 'enhanced' AND expires_at
>> = #{Time.now})
>
> Any tips on where to start would be brilliant.
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---