logo       

Re: Format dates prior to index: msg#00061

lang.ruby.ferret.general

Subject: Re: Format dates prior to index


On 07.12.2006, at 22:28, Joshua Kahn wrote:

> Hi all-
>
> I would like to enable search in my application via Ferret and a
> number
> of my searchable classes contain dates (of type Time). When these
> classes are indexed, the dates are written per the standard to_s
> output
> (e.g. "Wed Dec 07 08:56:04 CDT 2006"), which is not suitable for date
> range queries. Is it possible to format the dates before they are
> indexed (e.g. "20061207") without writing additional methods that
> output
> the dates in this format?


Is there something wrong with writing an additional method that does
the conversion? If you don't need the extra precision of Time use
Date. Its to_s method will give you "2006-12-07" right away.

--
Andy


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise