TermOrdsIterator#lookup throws ArrayIndexOutOfBoundsException [LUCENE-3377]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
TermOrdsIterator's lookup method can throw an ArrayIndexOutOfBoundsException if reuse argument is reused acros segments.
Example collector:
```Java
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](https://issues.apache.org/jira/browse/LUCENE-3377) by Martijn van Groningen (@martijnvg), updated Aug 17 2011
Contributor guide
Research direction
Start at DocTermOrds.TermOrdsIterator#lookup and inspect the collector example, especially reuse across IndexReader segments in setNextReader. Reproduce the failure with a reused iterator and verify that the example no longer throws ArrayIndexOutOfBoundsException; the issue does not name a specific test or file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100