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

RegExp automaton causes NPE on Terms.intersect

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment