lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley" <>
Subject Re: MissingStringLastComparatorSource and MultiSearcher
Date Sat, 15 Jul 2006 18:53:02 GMT
On 7/15/06, Rob Staveley (Tom) <> 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 Solr, the open-source Lucene search server

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message