Forget it, i think i found the issue. MySql automatically gets its
timezone information from the system if you dont set it in the
configuration file for mysql. As a result mine was set to PST. In
addition, the sphinx configuration using the UNIX_TIMESTAMP function
which converst to seconds since epoch but this conversion is done with
the timezone of the mysql5. When you do it with AR the conversion to/
from UTC is done for you by AR so there is not the same problem. After
i changed the default timezone to UTC then all seemed to work okay.
This might be a good gotcha to add to the documentation somewhere that
rails and mysqld have to be set to the same timezone or some of these
queries wont resolve properly.

Thanks for the response though.

Kiran

On Jan 18, 7:37 pm, Pat Allan <[email protected]> wrote:
> Hi Kiran
>
> What does you define_index block look like in your User model?
>
> Cheers
>
> --
> Pat
>
> On 19/01/2010, at 12:44 AM, Kiran wrote:
>
> > Hi,
> >  I have a pretty odd situation.
>
> > I have a model called User that has the standard updated_at and
> > created_at columns. If I do the following sequence i get incorrect
> > results from thinking sphinx. How would i go about debugging this?
>
> > t = Time.now.utc
> > u = User.last
> > u.phone_number = "92340923"
> > u.save
>
> > User.count :conditions => {:updated_at => t..Time.now.utc}
> > 1
> > User.search_count :with => {:updated_at => t..Time.now.utc}
> > 0
> > User.search :with => {:updated_at => t..Time.now.utc}
> > []
>
> > Any ideas?
> > --
> > 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 
> > athttp://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.


Reply via email to