Is this implementation of an iterator that returns documents between
first and last correct?
Going strictly by the javadoc, it's not... (docID specifically) but it
seems like it should be?
Is there anything in Lucene that this implementation would break?

class SliceDocIdSetIterator extends DocIdSetIterator {
 private int doc,last;

 public SliceDocIdSetIterator(int first, int last) {
   this.doc =first-1; this.last=last;
 }

 public int docID() {
   return doc;
 }

 public int nextDoc() throws IOException {
   if (++doc>last) doc=NO_MORE_DOCS;
   return doc;
 }

 public int advance(int target) throws IOException {
   doc=target;
   if (doc>last) doc=NO_MORE_DOCS;
   return doc;
 }
}


-Yonik
http://www.lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to