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

NPE on a degenerate query in MinimumShouldMatchIntervalsSource$MinimumMatchesIterator.getSubMatches()

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 9.0, 8.7
    • 9.0, 8.9, 8.8.2
    • None
    • None
    • New

    Description

      This query:

                    Query q1 =
                        new IntervalQuery(
                            FLD_TEXT1,
                            Intervals.ordered(
                                Intervals.atLeast(1, Intervals.term("foo")),
                                Intervals.atLeast(1, Intervals.term("bar"))));
      

      produces an NPE when retrieving match regions. Note degenerate atLeast with only one argument - this may play a role but it's not signaled anywhere before (the query itself does select the right documents, NPE blows up when matches are retrieved).

      Stack:

      java.lang.NullPointerException
      	at __randomizedtesting.SeedInfo.seed([2DDAAECF04D90D2F:EB69410397F8761E]:0)
      	at org.apache.lucene.queries.intervals.MinimumShouldMatchIntervalsSource$MinimumMatchesIterator.getSubMatches(MinimumShouldMatchIntervalsSource.java:389)
      	at org.apache.lucene.queries.intervals.CachingMatchesIterator.cache(CachingMatchesIterator.java:39)
      	at org.apache.lucene.queries.intervals.CachingMatchesIterator.next(CachingMatchesIterator.java:68)
      	at org.apache.lucene.queries.intervals.IntervalMatches$2.nextInterval(IntervalMatches.java:137)
      	at org.apache.lucene.queries.intervals.OrderedIntervalsSource$OrderedIntervalIterator.nextInterval(OrderedIntervalsSource.java:166)
      	at org.apache.lucene.queries.intervals.ConjunctionIntervalsSource.matches(ConjunctionIntervalsSource.java:89)
      	at org.apache.lucene.queries.intervals.IntervalQuery$IntervalWeight.lambda$matches$0(IntervalQuery.java:177)
      	at org.apache.lucene.search.MatchesUtils.forField(MatchesUtils.java:115)
      	at org.apache.lucene.queries.intervals.IntervalQuery$IntervalWeight.matches(IntervalQuery.java:174)
      	at org.apache.lucene.search.matchhighlight.MatchRegionRetriever.highlightDocument(MatchRegionRetriever.java:210)
      	at org.apache.lucene.search.matchhighlight.MatchRegionRetriever.highlightDocuments(MatchRegionRetriever.java:193)
      	at org.apache.lucene.search.matchhighlight.MatchRegionRetriever.highlightDocuments(MatchRegionRetriever.java:146)
      	at org.apache.lucene.search.matchhighlight.MatchHighlighter.highlight(MatchHighlighter.java:236)
      	at org.apache.lucene.search.matchhighlight.TestMatchHighlighter.lambda$testNpeOnIntervalQuery$7(TestMatchHighlighter.java:540)
      	at org.apache.lucene.search.matchhighlight.IndexBuilder.build(IndexBuilder.java:100)
      	at org.apache.lucene.search.matchhighlight.TestMatchHighlighter.testNpeOnIntervalQuery(TestMatchHighlighter.java:510)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
      

      Repro test attached.

      romseygeek, help!

      Attachments

        1. LUCENE-9744.patch
          3 kB
          Dawid Weiss
        2. LUCENE-9744.patch
          6 kB
          Alan Woodward

        Activity

          People

            romseygeek Alan Woodward
            dweiss Dawid Weiss
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m