Hi,

I use the code below to test same query on same index in one time.


long t0 = System.currentTimeMillis();
indexSearcher.search(query, from + size);
long t1 = System.currentTimeMillis();
LOGGER.info("indexSearcher.search(query, from + size) took:" + (t1 -
t0) + "ms");
TopScoreDocCollector collector = TopScoreDocCollector.create(from +
size, null, true);
indexSearcher.search(query, collector);
long t2 = System.currentTimeMillis();
LOGGER.info("TopScoreDocCollector took:" + (t2 - t1) + "ms");


The query is a simple long boolean query such like "title:(a strange perf
test....)".
The index is 13M docs.
Lucene version is 4.10.4.
No parallel search enabled, i.e.  ExectutorService is null in IndexSearcher

The first case is direct search, the second is use TopScoreDocCollector
which is indeed inner implementation of direct search.


I test many times, the result is very stable the first case result is about
300ms, the second is about 600ms.

I am wondering where is the difference from.

Anyone can give a hint?

Reply via email to