I hope someone can help me.
I have an index with tens of thousands of documents. Each document consists of several fields with texts and a field with an ID (integer). The search provides a list of the IDs.
To save resources, the maximum number of search results is limited to 10000. Usually this works very well. Now a case occurred, in which more than 10000 results would be found. Let's say 15000. Lucene search by default in increasing order of DocIDs, so Lucene delivers the first 10000 IDs.
I would find it better if Lucene provides the last 10000 IDs and thus the newer documents were found. Is there a way to change the Lucene search in decreasing order?
Just create a sort which sorts by document id in inverse order.
Sort sort = new Sort( new SortField( null, // or specify a field SortField.Type.DOC, true ) );
And then search for top, err, bottom 10K docs: