You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2014/07/19 23:32:19 UTC

svn commit: r1611970 - /lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesConsumer.java

Author: rmuir
Date: Sat Jul 19 21:32:19 2014
New Revision: 1611970

URL: http://svn.apache.org/r1611970
Log:
LUCENE-5836: when prefix-coding variable length terms, preallocate lastTerm to the correct size

Modified:
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesConsumer.java

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesConsumer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesConsumer.java?rev=1611970&r1=1611969&r2=1611970&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesConsumer.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesConsumer.java Sat Jul 19 21:32:19 2014
@@ -324,7 +324,7 @@ class Lucene49DocValuesConsumer extends 
       // we could avoid this, but its not much and less overall RAM than the previous approach!
       RAMOutputStream addressBuffer = new RAMOutputStream();
       MonotonicBlockPackedWriter termAddresses = new MonotonicBlockPackedWriter(addressBuffer, BLOCK_SIZE);
-      BytesRef lastTerm = new BytesRef();
+      BytesRef lastTerm = new BytesRef(Math.max(0, maxLength));
       long count = 0;
       for (BytesRef v : values) {
         if (count % ADDRESS_INTERVAL == 0) {