Sorry I've not responded to this sooner Jim. It's not the easiest problem to
figure out, having ranges on both sides... you'll want some range filters on
both attributes, I guess.
Probably useful to have some psuedo-max/min dates. Min is easy - the epoch
(1/1/1970). Max, well, I guess that's up to you. Maybe 1/1/2038? 32-bit integer
timestamps can't get much bigger than that.
:with => {
:available_from => min..Date.today,
:available_till => Date.tomorrow..max
}
I think that might work, but definitely give it some solid testing.
--
Pat
On 16/06/2010, at 4:31 PM, Jim Ruther Nill wrote:
> Hi!
>
> I have two columns, available_from and available_till and I want to filter
> the search results from a date given by the user.
>
> I have in my define_index block
>
> has 'DATE(available_from)', :as => :check_in, :type => :datetime
> has 'DATE(available_till)', :as => :check_out, :type => :datetime
>
> So how do I search if the user enters
>
> checkin: Date.today
> checkout: Date.tomorrow
>
> so that Date.today..Date.tomorrow is inside available_from..available_till
>
> Thanks!
>
>
> --
> 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.