TermOrdsIterator's lookup method can throw an ArrayIndexOutOfBoundsException if reuse argument is reused acros segments.
Example collector:
private DocTermOrds.TermOrdsIterator reuse = null;
public void collect(int doc) throws IOException {
...
reuse = docTermOrds.lookup(doc, reuse);
...
}
public void setNextReader(IndexReader.AtomicReaderContext context) throws IOException {
docTermOrds = FieldCache.DEFAULT.getDocTermOrds(context.reader, field);
....
}
If reuse argument is always null exception doesn't occur.
Migrated from LUCENE-3377 by Martijn van Groningen (@martijnvg), updated Aug 17 2011