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?