On Sun, Dec 06, 2009 at 05:31:53PM -0500, Erick Erickson wrote:
> This may be a silly question, and I admit that I haven't looked a the code,
> but was there a good reason to +1 it in the first place or was that just
> paranoia to prevent off-by-one errors? 

IIRC, this implementation of the priority queue algo leaves open slot 0 to
simplify internal calculations.  It was that way when I ported 1.4.3, and I
doubt that's changed.

> If there *was* a valid reason, might it make sense to 
> +1 min(nDocs, maxDoc())?

I think the patch is fine.  It's really only needed to provide a more accurate
error message in the event somebody specifies that they want Integer.MAX_VALUE
elements, not realizing that they will be allocated up front rather than
lazily -- they'll get an OOME rather than a NegativeArraySizeException.

Cheers,

Marvin Humphrey


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to