How do empty strings affect sorting?

I’m creating a search that allows results to be sorted in different
ways. In defining the sortable fields, I was careful to use untokenized
indexes. Everything was working great except for one field-- it refused
to sort properly, even though all the others were fine.

It seems as if the presence of empty strings in my data were to blame.
By setting them to a default value, sorting on that field suddenly
worked fine. Why is that? The same failure happened when I changed the
empty strings to nulls.

Do I always have to check for empty strings or nulls when defining sort
fields?

On 8/12/06, Bill L. [email protected] wrote:

Do I always have to check for empty strings or nulls when defining sort
fields?

Hi Bill,

This is a bug which has sort of been fixed in the latest version. I
say sort of because the solution is not really ideal. For integer or
float fields the default value is set to 0. Ideally, I think
undefined values should come after defined values no matter what the
order but this is a little harder to do with the current
implementation. It works for string fields but not for integer and
float fields.

Cheers,
Dave

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs