Greg, Pat, thanks for your replies!
Pat, I made the changes you suggested (combined the :with filters) and
am still having the same issue. The age range was correct though
(e.g.: max_age = 40 and min_age = 20). So
:birthdate => 40.years.ago..20.years.ago doesn't work, but
:birthdate => 30.years.ago..20.years.ago works.
Any ideas?
Thanks again.
Pat Allan wrote:
> I think there's two issues here... your range is around the wrong way,
> and you need both filters in the same option (one is going to
> overwrite the other):
>
> User.search :geo => [latitude, longitude],
> :sort => "@geodist ASC"
> :with => {
> "@geodist" => 0.0..miles_to_meters,
> :birthdate => min_age..max_age
> }
>
> Cheers
>
> --
> Pat
>
> On 12/06/2009, at 7:34 PM, Greg Weber wrote:
>
> >
> > Comparisons can only be done with integers. To convert a datetime
> > column to an integer, sphinx will use UNIX_TIMESTAMP, which counts up
> > from 0, starting around 1970. It seems like the solution to this would
> > be to cast the datetime as a string instead of a timestamp. Not sure
> > how that is accomplished.
> >
> > On Jun 12, 3:15 pm, temen <[email protected]> wrote:
> >> Hi,
> >>
> >> I am using Thinking Sphinx with geokit for location and age based
> >> search, and everything seems to be working until i enter max_age
> >> greater or equal to 40, where it then returns an empty set.
> >>
> >> Thanks.
> >>
> >> min_age = params[:min_age].to_i.years.ago
> >> max_age = params[:max_age].to_i.years.ago
> >> ...
> >>
> >> User.search :geo => [latitude, longitude],
> >> :with => {"@geodist" => (0.0..miles_to_meters)},
> >> :sort => "@geodist ASC",
> >> :with => { :birthdate => max_age..min_age }
> > >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---