NPE in SpanNear when used as exclusion for SpanNot
--------------------------------------------------

         Key: LUCENE-560
         URL: http://issues.apache.org/jira/browse/LUCENE-560
     Project: Lucene - Java
        Type: Bug

  Components: Search  
    Reporter: Hoss Man
 Attachments: LUCENE-560-test.patch

It seems that if you try to use a SpanNear query as the "exclude" argument to a 
SpanNot query, you encounter an NPE.  The stack trace looks like the following 
(as of trunk r398639) ...

    [junit] java.lang.NullPointerException
    [junit]     at 
org.apache.lucene.search.spans.NearSpans.doc(NearSpans.java:227)
    [junit]     at 
org.apache.lucene.search.spans.SpanNotQuery$1.next(SpanNotQuery.java:85)
    [junit]     at 
org.apache.lucene.search.spans.SpanScorer.next(SpanScorer.java:51)
    [junit]     at org.apache.lucene.search.Scorer.score(Scorer.java:47)
    [junit]     at 
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:132)

patch to TestBasics demonstrating bug will be attached shortly.  I believe the 
problem is that SpanNotQuery$1 is calling "excludeSpans.doc()" without ever 
calling "excludeSpans.next()" ... this "works" when the exclude query is a 
TermQuery becuase the value returned by doc() is -1 ... but with SpanNearQuery 
tries to pop the initial value off of a queue which hasn't been initialized yet.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to