You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Robert Muir (JIRA)" <ji...@apache.org> on 2015/04/03 15:18:54 UTC

[jira] [Resolved] (LUCENE-6385) NullPointerException from Highlighter.getBestFragment()

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

Robert Muir resolved LUCENE-6385.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 5.2
                   Trunk

Thanks again Terry

> NullPointerException from Highlighter.getBestFragment()
> -------------------------------------------------------
>
>                 Key: LUCENE-6385
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6385
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/highlighter
>    Affects Versions: 5.2
>            Reporter: Terry Smith
>            Assignee: Robert Muir
>             Fix For: Trunk, 5.2
>
>         Attachments: LUCENE-6385.patch
>
>
> When testing against the 5.1 nightly snapshots I've come across a NullPointerException in highlighting when nothing would be highlighted. This does not happen with 5.0.
> {noformat}
> java.lang.NullPointerException
> 	at __randomizedtesting.SeedInfo.seed([3EDC6EB0FA552B34:9971866E394F5FD0]:0)
> 	at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extractWeightedSpanTerms(WeightedSpanTermExtractor.java:311)
> 	at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:151)
> 	at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getWeightedSpanTerms(WeightedSpanTermExtractor.java:515)
> 	at org.apache.lucene.search.highlight.QueryScorer.initExtractor(QueryScorer.java:219)
> 	at org.apache.lucene.search.highlight.QueryScorer.init(QueryScorer.java:187)
> 	at org.apache.lucene.search.highlight.Highlighter.getBestTextFragments(Highlighter.java:196)
> 	at org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:156)
> 	at org.apache.lucene.search.highlight.Highlighter.getBestFragment(Highlighter.java:102)
> 	at org.apache.lucene.search.highlight.Highlighter.getBestFragment(Highlighter.java:80)
> 	at org.apache.lucene.search.highlight.MissesTest.testPhraseQuery(MissesTest.java:50)
> {noformat}
> I've written a small unit test and used git bisect to narrow the regression to the following commit:
> {noformat}
> commit 24e4eefaefb1837d1d4fa35f7669c2b264f872ac
> Author: Michael McCandless <mi...@apache.org>
> Date:   Tue Mar 31 08:48:28 2015 +0000
>     LUCENE-6308: cutover Spans to DISI, reuse ConjunctionDISI, use two-phased iteration
>     
>     git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/branch_5x@1670273 13f79535-47bb-0310-9956-ffa450edef68
> {noformat}
> The problem looks quite simple, WeightedSpanTermExtractor.extractWeightedSpanTerms() needs an early return if SpanQuery.getSpans() returns null. All other callers check against this.
> Unit test and fix (against the regressed commit) attached.



--
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