I'm trying to upgrade our application from Lucene 2.4.1 to Lucene 2.9.1. I've been using an InstantiatedIndex to do a bunch of unit testing, but am running into a some problems with Lucene 2.9.1. In particular, when I try to run a MatchAllDocsQuery on my InstantiatedIndex (which worked fine on 2.4.1) a NullPointerException is raised. I think I tracked down the problem in the Lucene source.
In the 2.9.1 MatchAllDocsQuery, the MatchAllScorer retrieves termDocs from the IndexReader passed to it with reader.termDocs(null) which I assume is supposed to return all termDocs. However, tracing this call down IndexReader.termDocs(term) calls InstantiatedTermDocs.seek( term) calls InstantiatedIndex.findTerm(term) which is implemented as InstantiatedTerm findTerm(Term term) { return findTerm(term.field(), term.text()); } which, since term is null, results in a NullPointerException. This seems to me like an bug either in the MatchAllDocsQuery implementation (the version in 2.4.1 did not use termDocs, so did not pass through this null), or a bug in the implementation of InstantiatedIndex. Any suggestions on what I can do about this? I definitely can't get rid of the MatchAllDocsQuery and don't really want to move back to a slow RAMDirectory.