final int numHits = numHits();
if (numHits > 0) {
if (withCollector() == false) {
if (sort != null) {
Weight w = q.weight(searcher);
TopFieldCollector collector = TopFieldCollector.create(sort, numHits,
true, withScore(),
withMaxScore(),
!w.scoresDocsOutOfOrder());
searcher.search(w, null, collector);
hits = collector.topDocs();
} else {
hits = searcher.search(q, numHits);
}
} else {
Collector collector = createCollector();