lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jake Clawson <>
Subject Re: How does sorting work in Lucene?
Date Tue, 15 Mar 2016 10:46:42 GMT
It would be very interesting to know about the questions Gimantha has raised. Is there any
documentation in the form of a book (rather than source code documentation) regarding the
internal workings of Lucene?


----- Original Message -----
From: Gimantha Bandara <>
To: "" <>
Sent: Saturday, March 12, 2016 10:16 AM
Subject: Re: How does sorting work in Lucene?

We are using our own clustering mechanism using Hazelcast. Sorting works
fine when the our server runs in standalone mode. Lucene returns the  doc
ids in the sorted order but the score is always 1.0. Is this expected? or
am I doing something wrong? ( Please note that the doc id order is returned
correctly) since the score is always 1.0, we dont have to a way to sort
results from several nodes when we cluster our servers. Even If the score
is 1.0, I have a doubt if the score is relative to the index on which the
search is performed. (So the score of a document from a specific index
cannot be compared to another document's score of a different index). If we
assume that the score is properly returned, can I use the scores of the
docs of different indices and sort all the doc ids from all the indexes(
probably using mergesort)?

On Tue, Mar 1, 2016 at 11:04 AM, Gimantha Bandara <> wrote:

> Any thoughts?
> On Monday, February 29, 2016, Gimantha Bandara <> wrote:
>> 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

> --
> Gimantha Bandara
> Software Engineer
> WSO2. Inc :
> Mobile : +94714961919

Gimantha Bandara
Software Engineer
WSO2. Inc :
Mobile : +94714961919

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

View raw message