Will this do? IndexReader indexReader = searcher.getIndexReader(); TopDocs topDocs = searcher.search(Query query, int n); for (int i = 0; i < topDocs.scoreDocs.length; i++) { Document document = indexReader.document( topDocs.scoreDocs[i].doc); final File f = new File( document.get( "FILE" ) ); }
> I have existing code that's like: > > final Term t = /* ... */; > final Iterator i = searcher.search( new > TermQuery( t ) ).iterator(); > while ( i.hasNext() ) { > final Hit hit = (Hit)i.next(); > // "FILE" is the field that recorded the original file indexed > final File f = new File( hit.get( "FILE" ) ); > // ... > } > > It's not clear to me how to rewrite the code using TopDocs/ > TopDocCollector and how to iterate over the results. > > A little help? Thanks. :-) > > - Paul > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org