Hi John

Given Sphinx deals with SQL data, you'd really need a SQL snippet that did the 
equivalent of your next_birthday method for an attribute. Perhaps something 
like this, if you're using MySQL:

  has 'DATE_ADD(birthday, INTERVAL (YEAR(NOW()) - YEAR(birthday)) YEARS)', :as 
=> :next_birthday, :type => :datetime

I've not tested that SQL snippet, nor am I sure what the equivalent would be 
for PostgreSQL... but once that's in your index definition, then searching gets 
easier:

  :with => {:next_birthday => Time.now..7.days.from_now}

Cheers

-- 
Pat

On 13/05/2011, at 7:49 AM, John Bartram wrote:

> Hi there, i'm pretty new to RoR & TS, and want to do a search for any
> users with upcoming birthdays in the next 7 days. I've defined
> next_birthday in my helper (def next_birthday) and wondering how i can
> incorporate this into my TS call.
> 
> So far I've got :with => { :born_on => config.search.
> 7.days.future..Time.current }.
> 
> Can anyone help?
> Thanks
> John
> 
> -- 
> 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.

Reply via email to