Lucene scores each document and then sorts them according to relevance in descending order.
i.e. the highest scoring documents are shown first.
Also, if two documents happen to have the same score, lucene then sorts the two docs according to the docId generated while indexing the doc.
Therefore, for docs with same scores, the sort order becomes the order in which they were added in lucene.

I would like to change this implementation.
I want lucene to score docs as it currently does..but when 2 docs have the same score, i want them to be sorted according to a custom logic.

How do I do this?
Do i need to extend the PageCollector and write a custom collector class?