Re: A few questions about numbers and dates

Hi David,

One possible solution is to add those fields twice
once in a stored/unindexed field in the correct format
for output and another in an unstored/indexed field
with the correct format for sorting and range queries.

Yes, I’ll likely do this, in combination with some form of hungarian
notation to indicate the “native” type of the field.

This would allow all dates to be stored as is by Ferret, but allow the
presentation layer to reformat the date for display to dd/mm/yyyy
format.

For numbers I am planning to pad the string with zeros which will
likewise support ranges/sorting, and then strip the zeros in the
presentation layer.

Actually, sorting will already work on those fields above

I don’t see how sorting could work for dates stored as “dd/mm/yyyy” …
Would you elaborate?

Finally, I’ve mentioned before that I’m very interested in
building an object database based on Ferret. I mentioned it here:
Ferret is now accepting donations - Ferret - Ruby-Forum
By turning documents into objects and giving fields types it
would solve the problems you have just mentioned plus many more.

Yes, I think this is a very interesting idea, very useful and
reminiscent of WinFS for objects!

Kind Regards

Neville

On 9/29/06, Neville B. [email protected] wrote:

Actually, sorting will already work on those fields above

I don’t see how sorting could work for dates stored as “dd/mm/yyyy” …
Would you elaborate?

Sorry, I meant, the date 2006-09-20 in you example would sort
correctly. You are quite right. “dd/mm/yyyy” won’t sort correctly.