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 ? > > > > 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. It rings some bells. One of them is that I would have preferred to split the SpanNear class into ordered/unordered after the fix, but that I gave up because it would take too much time. The current SpanNear class is too complex for easy maintenance. Perhaps the quick fix is to verify in the constructor of SpanNearQuery that the number of clauses is at least 2, and to throw an illegal arg exception otherwise. Regards, Paul Elschot --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]