У меня есть код, похожий на:
final Term t = /* ... */;
final Iterator i = searcher.search( new TermQuery( t ) ).iterator();
while ( i.hasNext() ) {
Hit hit = (Hit)i.next();
// "FILE" is the field that recorded the original file indexed
File f = new File( hit.get( "FILE" ) );
// ...
}
Мне непонятно, как переписать код с помощью TopDocs
/TopDocCollector
и как выполнить итерацию по всем результатам.