lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gimantha Bandara <>
Subject How does sorting work in Lucene?
Date Mon, 29 Feb 2016 04:22:35 GMT
Hi all,

We are using lucene to index our data and are maintaining millions of
documents in sharded indices. Currently what we do is, reading each shard
separately and collecting the TopDocs using TopDocCollector then sort them
by the score and returning the Top scored Documents. I think using the
MultiReader can replace this logic.

But I have some questions regarding sorting by a specific field/fields.

1. Does lucene sort at the search time or does it store sort information at
the index time in some way?

2. How would I implement pagination for a sorted set of documents? I have
several shards and each shard may contain millions of records.getting the
first few pages, each page having 100 documents or so may be fine. But lets
say I want to get the 1000th page. I have to sort the whole document sets
of all the shards and get the 1000th page once all the documents are
sorted. Does Lucene support pagination?

Help is much appreciated.
Gimantha Bandara
Software Engineer
WSO2. Inc :
Mobile : +94714961919

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message