Pete wrote:
> I want to create a condition on my search of "deals" so that it only
> searches for deals that:
> 
> :conditions => [ 'start_time < ?', Time.zone.now]
> 
> I am guessing that I have to add this condition somehow to my:
> 
> @query_results = Deal.search params[:search]
> 
> But I just cant work out how to write the condition in a sphinx
> friendly way...

You will want to add start_time to your index as an attribute like so:

  has :start_time

Then search like this:

  Deal.search(:with => (0..Time.zone.now.to_i))

Date attributes are stored in sphinx as integers, and there's no way to
search for documents with "an int less than", hence the range of ints.

-- James Healy <[email protected]>  Mon, 02 Nov 2009 14:57:29 +1100

--~--~---------~--~----~------------~-------~--~----~
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