Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
6.2.1
-
None
-
java version "1.8.0_77" macOS 10.12.1
-
New
Description
Calling org.apache.lucene.index.Terms.intersect(automaton, null) causes an NPE:
String index_path = <path to index>
String term = <a valid term name>
Directory directory = FSDirectory.open(Paths.get(index_path));
IndexReader reader = DirectoryReader.open(directory);
Fields fields = MultiFields.getFields(reader);
Terms terms = fields.terms(args[1]);
CompiledAutomaton automaton = new CompiledAutomaton(
new RegExp("do_not_match_anything").toAutomaton());
TermsEnum te = terms.intersect(automaton, null);
throws:
Exception in thread "main" java.lang.NullPointerException
at org.apache.lucene.codecs.blocktree.IntersectTermsEnum.<init>(IntersectTermsEnum.java:127)
at org.apache.lucene.codecs.blocktree.FieldReader.intersect(FieldReader.java:185)
at org.apache.lucene.index.MultiTerms.intersect(MultiTerms.java:85)
...