I guess there's no reason for DocSet not to implement Iterable. I wouldn't use it myself for most things... boxing each integer in a big set is a nice waste of CPU.
-Yonik On Thu, Mar 20, 2008 at 3:48 PM, Tricia Williams <[EMAIL PROTECTED]> wrote: > In my custom search component I'm using the DocSet > (http://lucene.apache.org/solr/api/org/apache/solr/search/DocSet.html) > supplied by a ResponseBuilder to iterate over TermPositions matched by > the users query and output the payload at each position. > > If DocSet implemented the Iterable interface > (http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Iterable.html) I > would be able to do something like: > > TermPositions tp = searcher.getReader().termPositions( new Term( fieldName, > term.text() ) ); > > for( int docId : docs ) { > tp.skipTo( docId ); > //gather payloads from this document > > } > > > rather than have to monkey around with the DocIterator. Is this worth > opening an issue and writing a patch? Granted this is pretty trivial. > Or maybe I'm not seeing the easier way. > > Tricia >
