On 4/9/07, John Joseph Bachir <[EMAIL PROTECTED]> wrote:
> That explains it very well, thanks. I wasn't aware of the default
> sort behavior. It might be worth it to mention that (more?)
> prominently in the documentation.

Point taken. I've added this to SortField:

 *  Note 1: Care should be taken when using the :auto sort-type since
 *  numbers will occur before other strings in the index so if you are sorting
 *  a field with both numbers and strings (like a title field which might have
 *  "24" and "Prison Break") then the sort_field will think it is sorting
 *  integers when it really should be sorting strings.
 *
 *  Note 2: When sorting by integer, integers are only 4 bytes so anything
 *  larger will cause strange sorting behaviour.

Plus this where the :sort parameter is mentioned;

 *  :sort::         A Sort object or sort string describing how the field
 *                  should be sorted. A sort string is made up of field names
 *                  which cannot contain spaces and the word "DESC" if you
 *                  want the field reversed, all seperated by commas. For
 *                  example; "rating DESC, author, title". Note that Ferret
 *                  will try to determine a field's type by looking at the
 *                  first term in the index and seeing if it can be parsed as
 *                  an integer or a float. Keep this in mind as you may need
 *                  to specify a fields type to sort it correctly. For more
 *                  on this, see the documentation for SortField

Let me know if you have any suggestions where else you might expect to
see something about this.

Cheers,
Dave
-- 
Dave Balmain
http://www.davebalmain.com/
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to