LUCENE-5836: when prefix-coding variable length terms, preallocate lastTerm to the correct size

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1611970 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-07-19 21:32:19 +00:00
parent d2218a8b85
commit 387ee2a6d3
1 changed files with 1 additions and 1 deletions

View File

@ -324,7 +324,7 @@ class Lucene49DocValuesConsumer extends DocValuesConsumer implements Closeable {
// 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) {