Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 7222 invoked from network); 3 Jul 2005 21:23:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Jul 2005 21:23:29 -0000 Received: (qmail 71195 invoked by uid 500); 3 Jul 2005 21:23:26 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 71165 invoked by uid 500); 3 Jul 2005 21:23:26 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 71152 invoked by uid 99); 3 Jul 2005 21:23:26 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jul 2005 14:23:26 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [194.109.24.27] (HELO smtp-vbr7.xs4all.nl) (194.109.24.27) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jul 2005 14:23:27 -0700 Received: from k8l.lan (porta.xs4all.nl [80.127.24.69]) by smtp-vbr7.xs4all.nl (8.13.3/8.13.3) with ESMTP id j63LNMB0066442 for ; Sun, 3 Jul 2005 23:23:22 +0200 (CEST) (envelope-from paul.elschot@xs4all.nl) From: Paul Elschot To: java-dev@lucene.apache.org Subject: Re: Unexpected: ordered Date: Sun, 3 Jul 2005 23:23:22 +0200 User-Agent: KMail/1.5.4 References: <20050629135856.83265.qmail@web26004.mail.ukl.yahoo.com> <200507031639.05068.paul.elschot@xs4all.nl> <1120405348.42c8076457261@sms.ed.ac.uk> In-Reply-To: <1120405348.42c8076457261@sms.ed.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200507032323.22118.paul.elschot@xs4all.nl> X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Sunday 03 July 2005 17:42, Dave Kor wrote: > Quoting Paul Elschot : > > > 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: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org