You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2014/02/27 22:03:42 UTC

svn commit: r1572729 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/CHANGES.txt lucene/core/ lucene/core/src/java/org/apache/lucene/util/packed/EliasFanoEncoder.java

Author: jpountz
Date: Thu Feb 27 21:03:41 2014
New Revision: 1572729

URL: http://svn.apache.org/r1572729
Log:
LUCENE-5432: Fix EliasFanoEncoder's number of bits per index entry.

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/EliasFanoEncoder.java

Modified: lucene/dev/branches/branch_4x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/CHANGES.txt?rev=1572729&r1=1572728&r2=1572729&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/lucene/CHANGES.txt Thu Feb 27 21:03:41 2014
@@ -29,6 +29,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 _.

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/EliasFanoEncoder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/EliasFanoEncoder.java?rev=1572729&r1=1572728&r2=1572729&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/EliasFanoEncoder.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/EliasFanoEncoder.java Thu Feb 27 21:03:41 2014
@@ -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);