LUCENE-5432: Fix EliasFanoEncoder's number of bits per index entry.

Close #28


git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1572728 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrien Grand 2014-02-27 21:01:15 +00:00
parent fcec01ccda
commit f0d4dd2252
2 changed files with 4 additions and 1 deletions

View File

@ -92,6 +92,9 @@ Bug fixes
NullPointerException, if the synonym map is empty when creating
SynonymFilter (帅广应 via Mike McCandless)
* LUCENE-5432: EliasFanoDocIdSet: Fix number of index entry bits when the maximum
entry is a power of 2. (Paul Elschot via Adrien Grand)
Test Framework
* LUCENE-5449: Rename _TestUtil and _TestHelper to remove the leading _.

View File

@ -177,7 +177,7 @@ public class EliasFanoEncoder {
this.numIndexEntries = (nIndexEntries >= 0) ? nIndexEntries : 0;
long maxIndexEntry = maxHighValue + numValues - 1; // clear upper bits, set upper bits, start at zero
this.nIndexEntryBits = (maxIndexEntry <= 0) ? 0
: (64 - Long.numberOfLeadingZeros(maxIndexEntry - 1));
: (64 - Long.numberOfLeadingZeros(maxIndexEntry));
long numLongsForIndexBits = numLongsForBits(numIndexEntries * nIndexEntryBits);
if (numLongsForIndexBits > Integer.MAX_VALUE) {
throw new IllegalArgumentException("numLongsForIndexBits too large to index a long array: " + numLongsForIndexBits);