Oh my .. it was too early i guess .. here is the simple solution:

define_indexes do
    has "registration_accepted_from_date >= CURDATE() AND
registration_accepted_to_date <= CURDATE()", :as
=> :registration_accepted, :type => :boolean
end

Nevermind.

Greets
-act

On 6 Nov., 08:21, ACTRAiSER <[email protected]> wrote:
> Hi everyone,
>
> I have stored two dates with a tournament model in the database
> "registration_accepted_from_date" and
> "registration_accepted_to_date".
>
> In the search form with a single checkbox i want to find all
> tournaments where registration is currently open, meaning, where
> Time.now lies within the range of those two stored dates.
>
> #my indexing should be straight forward:
> define_index do
>     has registration_accepted_from_date
>     has registration_accepted_to_date
>   end
>
> Now what? :-) I know how to search a single date field in the database
> with a range composed of two dates, e.g. from a form.  But how does
> the opposite work: you have the two dates already stored in the
> database and want to check if a single date (e.g. Time.now) lies
> within the range of those stored dates?
>
> Hints are appreciated :-)
>
> greets
> -act
--~--~---------~--~----~------------~-------~--~----~
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