[KinoSearch] Sorting by date
paikkos at googlemail.com
Thu Jan 7 05:43:20 PST 2010
2010/1/7 Marvin Humphrey <marvin at rectangular.com>:
> On Thu, Jan 07, 2010 at 12:41:54PM +0000, Dermot wrote:
>> If you want to sort by date, does the value supplied to spec_field
>> need to be in a specific format?
> The standard technique is to use a sortable string format, e.g. "YYYY-MM-DD
> HH:MM:SS" normalized to GMT.
My dates are currently stored in UTC format, 2010-01-05T00:00:00. Are
you saying that I should convert them (before indexing) to
"YYYY-MM-DD HH:MM:SS", EG s/T/ /, and store them as a StringType and
the SortRule will work?
> FWIW, there's undocumented, experimental support for sortable numeric fields
> (Int32Type, Int64Type, Float32Type, Float64Type) in the current release
> (0.30_072). Those FieldType classes aren't advertised because they cannot yet
> be "indexed", but they can be "stored" and "sortable". Eventually,
> recommended practice for sorting by date will be to convert to a timestamp and
> use an Int32Type (modulo the usual range caveats for 32-bit timestamps blah
> blah blah). See the test file t/511-sort_spec.t for example code if you're
I am currently using StringType for integers and sorting them which
appears to be working fine. I'd assumed it would also work with
timestamps too. I'm using 0.30_071 which has the test your referring
to. Should I switch to Int*Type for my integers?
>> IE: should I convert my dates in UNIX timestamps so it's a straight numeric
>> sort or is there some magic (yes I am lazy) that will accept a DateTime
> No special handling for DateTime objects, and no plans to add any.
Yes I kinda thought this was asking for too much :)
More information about the kinosearch