NearSpan

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

NearSpan

Karl Wettin-3
I don't understand what it means when this exception is thrown. I'm  
quite certain that it is my skipTo(target)-code that causes it , but  
I don't understand why. The FIXME and error message makes me think it  
might be that I deliver the data ordered and it was not expected to be?

private boolean firstNonOrderedNextToPartialList() throws IOException {
     /* Creates a partial list consisting of first non ordered and  
earlier.
      * Returns first non ordered .next().
      */
     last = first = null;
     int orderedIndex = 0;
     while (queue.top() != null) {
       SpansCell cell = (SpansCell)queue.pop();
       addToList(cell);
       if (cell.index == orderedIndex) {
         orderedIndex++;
       } else {
         return cell.next();
         // FIXME: continue here, rename to eg. checkOrderedMatch():
         // when checkSlop() and not ordered, repeat cell.next().
         // when checkSlop() and ordered, add to list and repeat  
queue.pop()
         // without checkSlop(): no match, rebuild the queue from the  
partial list.
         // When queue is empty and checkSlop() and ordered there is  
a match.
       }
     }
     throw new RuntimeException("Unexpected: ordered");
   }

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: NearSpan

Michael Goddard-2
Karl,

If you get this one figured out, I'd be very happy.  Unless I replace
the line reading

    throw new RuntimeException("Unexpected: ordered");

with this one

    return false;

I see plenty of these exceptions being thrown.  I look forward to how
this plays out and if you are able to come up with a solution!

    Mike

P.S. This change was mentioned in a previous thread:
 
http://mail-archives.apache.org/mod_mbox/lucene-java-dev/200601.mbox/%3C200601272129.54523.paul.elschot@...%3E



karl wettin wrote:

> I don't understand what it means when this exception is thrown. I'm
> quite certain that it is my skipTo(target)-code that causes it , but I
> don't understand why. The FIXME and error message makes me think it
> might be that I deliver the data ordered and it was not expected to be?
>
> private boolean firstNonOrderedNextToPartialList() throws IOException {
>     /* Creates a partial list consisting of first non ordered and
> earlier.
>      * Returns first non ordered .next().
>      */
>     last = first = null;
>     int orderedIndex = 0;
>     while (queue.top() != null) {
>       SpansCell cell = (SpansCell)queue.pop();
>       addToList(cell);
>       if (cell.index == orderedIndex) {
>         orderedIndex++;
>       } else {
>         return cell.next();
>         // FIXME: continue here, rename to eg. checkOrderedMatch():
>         // when checkSlop() and not ordered, repeat cell.next().
>         // when checkSlop() and ordered, add to list and repeat
> queue.pop()
>         // without checkSlop(): no match, rebuild the queue from the
> partial list.
>         // When queue is empty and checkSlop() and ordered there is a
> match.
>       }
>     }
>     throw new RuntimeException("Unexpected: ordered");
>   }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: NearSpan

Paul Elschot
In reply to this post by Karl Wettin-3
Karl,

On Tuesday 18 April 2006 17:48, karl wettin wrote:
> I don't understand what it means when this exception is thrown. I'm  
> quite certain that it is my skipTo(target)-code that causes it , but  
> I don't understand why. The FIXME and error message makes me think it  
> might be that I deliver the data ordered and it was not expected to be?

Although it fixed another bug at the time, the line throwing the exception
is actually unfinished code. There are two ways to improve this:
- use the NearSpans...  code and the patch for SpanNearQuery from here:
http://issues.apache.org/jira/browse/LUCENE-413
The NearSpansOrdered there is a bit restrictive in that it does not match
spans that have indexed positions in common.
- delete the line throwing the exception. Iirc, there was a report that this
could work, but I don't know what the method should return in that case.

Also, the skipTo() methods in SpanScorer and DisjunctionSumScorer were
recently changed at the same LUCENE-413 issue.

Regards,
Paul Elschot




> private boolean firstNonOrderedNextToPartialList() throws IOException {
>      /* Creates a partial list consisting of first non ordered and  
> earlier.
>       * Returns first non ordered .next().
>       */
>      last = first = null;
>      int orderedIndex = 0;
>      while (queue.top() != null) {
>        SpansCell cell = (SpansCell)queue.pop();
>        addToList(cell);
>        if (cell.index == orderedIndex) {
>          orderedIndex++;
>        } else {
>          return cell.next();
>          // FIXME: continue here, rename to eg. checkOrderedMatch():
>          // when checkSlop() and not ordered, repeat cell.next().
>          // when checkSlop() and ordered, add to list and repeat  
> queue.pop()
>          // without checkSlop(): no match, rebuild the queue from the  
> partial list.
>          // When queue is empty and checkSlop() and ordered there is  
> a match.
>        }
>      }
>      throw new RuntimeException("Unexpected: ordered");
>    }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]