lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <>
Subject RE: Lucene 5.0.0 - StringField and Sorting
Date Mon, 25 Apr 2016 18:06:57 GMT
In Lucene you have to use the new DocValues fields (available since 4.0) to sort on.

For backwards compatibility, you can still use the older "uninversion" hack (also known as
"Field Cache"). In Lucene 5 and 6 this part was removed from Lucene Core. To sort, you have
2 options:

- Reindex your stuff with DocValues fields enabled. This new field type is optimized for random
access as used by sorting. This is the recommended approach.

- Alternatively you can use UninvertingReader from the misc module and wrap your index reader.
This "emulates" the DocValues APIs on indexes without DocValues. Internally it uses the old
FieldCache code to do this. This has the same problems as earlier Lucene versions: Heavy heap
usage and slow uninversion of field values. To use it you must wrap every segment of your
index separately (e.g. by implementing FilterDirectoryReader) using

Erick: Solr has UninvertingReader used by default in SolrIndexSearcher.


Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen

> -----Original Message-----
> From: Torsten Krah []
> Sent: Monday, April 25, 2016 6:25 PM
> To: Erick Erickson <>
> Cc: java-user <>
> Subject: Re: Lucene 5.0.0 - StringField and Sorting
> Hi Erick,
> i guess you've muddled the lists - this is lucenes one, not solr. I know
> how to define it in solr but that wasn't the question as i am using pure
> lucene and it did not work as expected from the javadocs there.
> Cheers
> Torsten
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message