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

RegExp automaton causes NPE on Terms.intersect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 6.2.1
    • 6.4, 7.0
    • core/codecs, core/index
    • 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)
      ...

      Attachments

        1. LUCENE-7576.patch
          3 kB
          Michael McCandless

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: