Thanks, Pat.
That helped me on my way.
has "IF(aasm_state = 'enhanced', UNIX_TIMESTAMP(expires_at), #
{0xFFFFFFFF})",
:as => :enhanced_expire, :type => :integer
Had a few problems until I realised that sphinx needed an integer and
not a datetime. D'oh!
Cheers.
On Mar 3, 9:06 am, Pat Allan <[email protected]> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---