java - Search Lucene in decreasing order of doc Id -


i hope can me.

i have index tens of thousands of documents. each document consists of several fields texts , field id (integer). search provides list of ids.

to save resources, maximum number of search results limited 10000. works well. case occurred, in more 10000 results found. let's 15000. lucene search default in increasing order of docids, lucene delivers first 10000 ids.

i find better if lucene provides last 10000 ids , newer documents found. there way change lucene search in decreasing order?

just create sort sorts document id in inverse order.

sort sort = new sort(    new sortfield(       null,                    // or specify field       sortfield.type.doc,        true    ) ); 

and search top, err, bottom 10k docs:

indexsearcher.search(query, 10000); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -