On 7/15/06, Rob Staveley (Tom) <[EMAIL PROTECTED]> wrote:
The problem one is
testSortingReverseNullFirst. My reckoning is that you are forward-sorting
(or ascending-sorting if that's the right thing to say) the non-nulls.

OK, examples are probably easier to work with.
If we have a list of [A,null,Z] and we want that reverse sorted, then
we want nulls first, the result should be [null,Z,A].

If we were to use nullStringLastComparatorSource (which orders nulls
last in an *ascending* Lucene sort), the result would be [A,Z,null].
If we reverse this lucene sort, we get [null,Z,A], the desired result.

Ahhh, but in the code, we aren't doing the last reverse!  That does look wrong.

return new SortField(fieldName,nullStringLastComparatorSource); // <-- !!!

Great catch!  I think we never noticed because all of our usecases
called for nulls to sort last.  I'll add a test to Solr for this case.


-Yonik
http://incubator.apache.org/solr Solr, the open-source Lucene search server

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to