You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2016/11/28 16:37:58 UTC

[jira] [Updated] (LUCENE-7576) RegExp automaton causes NPE on Terms.intersect

     [ https://issues.apache.org/jira/browse/LUCENE-7576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-7576:
---------------------------------------
    Attachment: LUCENE-7576.patch

Patch w/ test (thank you!) and fix.  This is unfortunately a confusing expert API; other terms dicts were checking that the provided compiled automaton is {{NORMAL}} and throwing a clearer exception if not, so I carried that same check over to the default terms dict.  I also added a note to the javadocs for {{Terms.intersect}}.

> RegExp automaton causes NPE on Terms.intersect
> ----------------------------------------------
>
>                 Key: LUCENE-7576
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7576
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/codecs, core/index
>    Affects Versions: 6.2.1
>         Environment: java version "1.8.0_77" macOS 10.12.1
>            Reporter: Tom Mortimer
>            Assignee: Michael McCandless
>            Priority: Minor
>         Attachments: LUCENE-7576.patch
>
>
> 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)
>         ...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org