Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7576

RegExp automaton causes NPE on Terms.intersect

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 6.2.1
    • Fix Version/s: 6.4, 7.0
    • Component/s: core/codecs, core/index
    • Labels:
      None
    • Environment:

      java version "1.8.0_77" macOS 10.12.1

    • Lucene Fields:
      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)
      ...

        Attachments

        1. LUCENE-7576.patch
          3 kB
          Michael McCandless

          Activity

            People

            • Assignee:
              mikemccand Michael McCandless
              Reporter:
              TomMortimer Tom Mortimer
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: