@Test
public void testSimpleSearchPagingWithSorting() throws Exception {
IndexReader reader = getReaderFlatScore(13245);
IndexSearcher searcher = new IndexSearcher(reader);
TotalHitsRef totalHitsRef = new TotalHitsRef();
ProgressRef progressRef = new ProgressRef();
printHeapSize();
TermQuery query = new TermQuery(new Term("f1", "value"));
Sort sort = new Sort(new SortField("index", Type.INT, true));
IterablePaging paging = new IterablePaging(new AtomicBoolean(true), searcher, query, 100, null, null, false, sort,
new DeepPagingCache());
IterablePaging itPaging = paging.skipTo(90).gather(20).totalHits(totalHitsRef).progress(progressRef);
BlurIterator<ScoreDoc, BlurException> iterator = itPaging.iterator();
int position = 90;
int searches = 1;
while (iterator.hasNext()) {
ScoreDoc sd = iterator.next();
assertEquals(position, progressRef.currentHitPosition());
assertEquals(searches, progressRef.searchesPerformed());
System.out.println("time [" + progressRef.queryTime() + "] " + "total hits [" + totalHitsRef.totalHits() + "] "
+ "searches [" + progressRef.searchesPerformed() + "] " + "position [" + progressRef.currentHitPosition()
+ "] " + "doc id [" + sd.doc + "] " + "score [" + sd.score + "]");
position++;
if (position == 100) {
searches++;