Hi Erik,
The only way I can see this exception being thrown is when you have
two SpanCells with the same start in a particular document. In this
case matchIsOrdered will return false even though the SpanCells may
still be ordered in the priority queue. The current code for
matchIsOrdered is;
private boolean matchIsOrdered() {
int lastStart = -1;
for (int i = 0; i < ordered.size(); i++) {
int start = ((SpansCell)ordered.get(i)).start();
if (!(start > lastStart))
return false;
lastStart = start;
}
return true;
}
I think maybe;
if (!(start > lastStart))
should be;
if (start < lastStart)
I'm afraid I don't have time to test this but hopefully it'll help.
Cheers,
Dave
On 1/25/06, Erik Hatcher <[EMAIL PROTECTED]> wrote:
> In using SpanQuery in a sophisticated way, we've experienced an issue
> with NearSpans giving the following exception:
>
> java.lang.RuntimeException: Unexpected: ordered
> at
> org.apache.lucene.search.spans.NearSpans.firstNonOrderedNextToPartialLis
> t(NearSpans.java:291)
> at org.apache.lucene.search.spans.NearSpans.next
> (NearSpans.java:183)
> at org.apache.lucene.search.spans.SpanScorer.next
> (SpanScorer.java:50)
> at org.apache.lucene.search.BooleanScorer$SubScorer.<init>
> (BooleanScorer.java:48)
> at org.apache.lucene.search.BooleanScorer.add
> (BooleanScorer.java:76)
> at org.apache.lucene.search.BooleanQuery$BooleanWeight.scorer
> (BooleanQuery.java:274)
> at org.apache.lucene.search.IndexSearcher.search
> (IndexSearcher.java:98)
> at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:65)
> at org.apache.lucene.search.Hits.<init>(Hits.java:44)
> at org.apache.lucene.search.Searcher.search(Searcher.java:44)
> at org.apache.lucene.search.Searcher.search(Searcher.java:36)
>
> This is using the current trunk code. I believe this may be related
> to http://issues.apache.org/jira/browse/LUCENE-413
>
> Unfortunately I cannot share the exact index or query, but the query
> ends up being a BooleanQuery with about 10 clauses, some being simple
> TermQuery's, and others being SpanNearQuery's nested with
> SpanRegexQuery's and SpanTermQuery's.
>
> Thoughts? Is this related to LUCENE-413? Shall I re-apply all those
> patches (if they still work) and give it another try?
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]