On 03/04/2010 11:34 AM, Goddard, Michael J. wrote:
// Question: why wouldn't this Span be found?
assertTrue("fourth range", spans.next());
assertEquals("fourth doc", 11, spans.doc());
assertEquals("fourth start", 2, spans.start());
assertEquals("fourth end", 6, spans.end());
Spans are funny beasts ;)
No Spans ever start from the same position more than once. In effect,
they are always marching forward.
The third range starts at 2, and once it finds a match starting at 2, it
moves on. So it won't find the other
match that starts at 2. Spans are not exhaustive - exhaustive matching
would be a different algorithm.
So yes, you are wrong in your expectation :) Just how Spans were
implemented.
--
- Mark
http://www.lucidimagination.com