Index: lucene/facet/src/java/org/apache/lucene/facet/search/StandardFacetsAccumulator.java =================================================================== --- lucene/facet/src/java/org/apache/lucene/facet/search/StandardFacetsAccumulator.java (revision 1432028) +++ lucene/facet/src/java/org/apache/lucene/facet/search/StandardFacetsAccumulator.java (working copy) @@ -234,6 +234,7 @@ HashMap categoryLists = getCategoryListMap(facetArrays, partition); + // nocommit IntsRef ordinals = new IntsRef(32); // a reasonable start capacity for most common apps for (Entry entry : categoryLists.entrySet()) { CategoryListIterator categoryList = entry.getKey(); Index: lucene/facet/src/java/org/apache/lucene/util/encoding/VInt8IntDecoder.java =================================================================== --- lucene/facet/src/java/org/apache/lucene/util/encoding/VInt8IntDecoder.java (revision 1432028) +++ lucene/facet/src/java/org/apache/lucene/util/encoding/VInt8IntDecoder.java (working copy) @@ -1,7 +1,9 @@ package org.apache.lucene.util.encoding; +import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.IntsRef; +import org.apache.lucene.util.RamUsageEstimator; /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -29,12 +31,75 @@ @Override protected void doDecode(BytesRef buf, IntsRef values, int upto) { + /* + int needed = upto - buf.offset; + if (values.length < needed) { + values.grow(needed); + } + */ + if (values.ints.length < buf.length) { + values.ints = new int[ArrayUtil.oversize(buf.length, RamUsageEstimator.NUM_BYTES_INT)]; + } + int value = 0; + int offset = buf.offset; + while (offset < upto) { + byte b = buf.bytes[offset++]; + if (b >= 0) { + values.ints[values.length++] = (value << 7) | b; + value = 0; + } else { + value = (value << 7) | (b & 0x7F); + } + + /* + // byte 1 + byte b = buf.bytes[offset++]; + if (b >= 0) { + values.ints[values.length++] = b; + continue; + } + + // byte 2 + int value = b & 0x7F; + b = buf.bytes[offset++]; + if (b >= 0) { + values.ints[values.length++] = (value << 7) | b; + continue; + } + value = (value << 7) | b & 0x7F; + + // byte 3 + b = buf.bytes[offset++]; + if (b >= 0) { + values.ints[values.length++] = (value << 7) | b; + continue; + } + value = (value << 7) | b & 0x7F; + + // byte 4 + b = buf.bytes[offset++]; + if (b >= 0) { + values.ints[values.length++] = (value << 7) | b; + continue; + } + value = (value << 7) | b & 0x7F; + + // byte 5 + b = buf.bytes[offset++]; + assert b >= 0; + values.ints[values.length++] = (value << 7) | b; + */ + } + buf.offset = offset; + + /* while (buf.offset < upto) { if (values.length == values.ints.length) { values.grow(values.length + 10); // grow by few items, however not too many } values.ints[values.length++] = VInt8.decode(buf); } + */ } @Override