On Sunday 03 July 2005 17:42, Dave Kor wrote:
> Quoting Paul Elschot <[EMAIL PROTECTED]>:
> 
> > On Sunday 03 July 2005 15:27, Dave Kor wrote:
> > > I have a system that automatically generate span queries to Lucene.
> > Sometimes,
> > > the system generates a query like this one which always throws a
> > > RuntimeException:
> > >
> > > spanNear([spanNear([text:interesting], 3, true),
> > spanNear([text:interesting,
> > > text:john, text:said], 8, true)], 2, true)
> > >
> > > Basically, the system is looking for a document that contains a string
> > sequence
> > > "interesting .... interesting john said". The thrown exception is as
> > follows:
> > >
> > > java.lang.RuntimeException: Unexpected: ordered
> > >         at
> > >
> >
> 
org.apache.lucene.search.spans.NearSpans.firstNonOrderedNextToPartialList(Unknown
> > > Source)
> > >         at org.apache.lucene.search.spans.NearSpans.next(Unknown Source)
> > >         at org.apache.lucene.search.spans.SpanScorer.next(Unknown 
Source)
> > >         at org.apache.lucene.search.Scorer.score(Unknown Source)
> > >         at org.apache.lucene.search.IndexSearcher.search(Unknown Source)
> > >
> > > My question is, what does is this "Unexpected: ordered" mean? and is 
there
> > > anyway I can avoid these exceptions?
> >
> > It's an internal error that is not supposed to occur.
> > Could you continue on the java-dev list?
> >
> > SpanNearQuery is not supposed to operate on a single argument, at least
> > that's what I thought when I wrote the bug fix code that throws this
> > exception. Does the exception go away when you replace the first spanNear
> > (the one with the single [text:interesting]  with a SpanTermQuery ?

See below.

> >
> > It's also possible that the code cannot handle the two identical
> > text:interesting arguments.
> >
> > It's probably good to have a test case for this. Could you extend the
> > exception with the document number and maybe a position within the
> > document to try and get to the original text that causes this exception,
> > and use that to file a bug report?
> 
> I'll see what I can do about the test case. From what I can tell thus far, 
this
> exception is thrown when CellQueue is empty in the function
> NearSpan.firstNonOrderedNextToPartialList(). I hope it rings a bell 
somewhere.

I had another look at the code, and my guess now is that this is related to
the spanNear with the single argument. So I'd like to know what
happens when this is replaced by a SpanTermQuery.

It does ring some bells. One of them is that I would have prefered to split
the NearSpans class into two after the bug fix, one for the ordered case,
and one for the non ordered case. I did not make that split then because it
worked for the test cases, and I did not want to spend more time on it.
Anyway, the current NearSpans code is too complex for easy maintenance.

Perhaps the quick fix is to make sure that the SpanNearQuery passed to
the NearSpans has at least two clauses, and that the SpanNearQuery constructor
throws an IllegalArgumentException otherwise.

Regards,
Paul Elschot


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

Reply via email to