Michael McCandless
added a comment - 10/Dec/09 21:33 Patch looks good; tests pass. I'll commit shortly.
The core change is to just make it possible to override isDeleted logic in AllTermDocs.
The flex API makes this easier – you must provided a Bits (new interface), specifying the docs you want to skip, when you request the DocsEnum.
We should fix this on at least 3.0 as well right?

Karl Wettin
added a comment - 10/Dec/09 22:08 at org.apache.lucene.store.instantiated.TestIndicesEquals.testTermDocsSomeMore(TestIndicesEquals.java:226)
I have no idea. How do I merge back locally so I can debug it?

// this is invalid use of the API,
// but if the response differs then it's an indication that something might have changed.
// in 2.9 and 3.0 the two TermDocs-implementations returned different values at this point.
assertEquals("Descripency during invalid use of the TermDocs API, see comments in test code for details.",
aprioriTermDocs.next(), testTermDocs.next());

Karl Wettin
added a comment - 10/Dec/09 23:28 Committed change to trunk.
In 3.0 comment out ~line 227 in TestIndicesEquals
// this is invalid use of the API,
// but if the response differs then it's an indication that something might have changed.
// in 2.9 and 3.0 the two TermDocs-implementations returned different values at this point.
assertEquals("Descripency during invalid use of the TermDocs API, see comments in test code for details.",
aprioriTermDocs.next(), testTermDocs.next());

I don't have any strong feelings about this line of code, but let me at least explain it.

I like the idea that IIFoo behaves the same way a SegementFoo, even during incorrect/undocumented use of the API.

There are no real use cases for this in the Lucene distribution, there are however effects people might use even though caused by invalid use of the API and not recommened. E.g. a skipTo to a target greater than the greatest document associated with that term will position the enum at the greatest document number for that term. Even though I wouldn't do something like this others might.

In this case, where an immediate #next() on IR#termDocs() is called, it's might look silly to compare the behaviour of II and Segment as it's such blatantly erroneous use of the API, but even I have been known to come up with some rather strange solution now and then when nobody else is looking.

One alternative is that #next would produce an InvalidStateException or something instead of just accepting the call, but then there is of course the small extra cost associated with checking if the enum has been seeked yet and #next is a rather commonly used method.

Karl Wettin
added a comment - 11/Dec/09 11:26 I don't have any strong feelings about this line of code, but let me at least explain it.
I like the idea that IIFoo behaves the same way a SegementFoo, even during incorrect/undocumented use of the API.
There are no real use cases for this in the Lucene distribution, there are however effects people might use even though caused by invalid use of the API and not recommened. E.g. a skipTo to a target greater than the greatest document associated with that term will position the enum at the greatest document number for that term. Even though I wouldn't do something like this others might.
In this case, where an immediate #next() on IR#termDocs() is called, it's might look silly to compare the behaviour of II and Segment as it's such blatantly erroneous use of the API, but even I have been known to come up with some rather strange solution now and then when nobody else is looking.
One alternative is that #next would produce an InvalidStateException or something instead of just accepting the call, but then there is of course the small extra cost associated with checking if the enum has been seeked yet and #next is a rather commonly used method.