lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <>
Subject [jira] [Created] (LUCENE-4403) sharpen javadocs for DISI.docID() when unpositioned
Date Mon, 17 Sep 2012 20:25:07 GMT
Robert Muir created LUCENE-4403:

             Summary: sharpen javadocs for DISI.docID() when unpositioned
                 Key: LUCENE-4403
             Project: Lucene - Core
          Issue Type: Bug
            Reporter: Robert Muir

Spinoff from LUCENE-4401.

Currently DISI requires an unpositioned iterator to be -1 or NO_MORE_DOCS. But I think we
should refine this: in my opinion NO_MORE_DOCS should mean NO_MORE_DOCS.

So its ok for it to return NO_MORE_DOCS when its unpositioned, but only if it can already
determine that its exhausted.

This makes life easier on consumers.

Separately we cant really test this situation very well as long as the javadocs for nextDoc
say, Returns the following:

    -1 or NO_MORE_DOCS if nextDoc() or
    advance(int) were not called yet.
    NO_MORE_DOCS if the iterator has exhausted.
    Otherwise it should return the doc ID it is currently on.

This prevents us from being able to easily assert that nobody is calling nextDoc()/advance()
after the enum is exhausted, since we cannot differentiate 'exhausted' from 'uninitialized'.

I think we should clarify the javadocs, such that if nextDoc()/advance() are not called yet,
you can still return NO_MORE_DOCS, but only if you somehow know you are exhausted-before-you-start.

It could also be everyone reads it this way already, and I'm just being super-anal.

+1 to sharpen when a DocsEnum can return NO_MORE_DOCS before nextDoc: it should only be if
the enum knows it has zero docs. But I'm not even sure we should allow that ... why not always
make it -1 ...? We can do that separately...

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message