re-enable horrible caching

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1442789 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2013-02-05 23:09:30 +00:00
parent 7b19bd1541
commit df3edbb80f
2 changed files with 8 additions and 6 deletions

View File

@ -214,7 +214,7 @@ public class MultiDocValues {
if (!anyReal) {
return null;
} else {
OrdinalMap mapping = new OrdinalMap(values);
OrdinalMap mapping = new OrdinalMap(r.getCoreCacheKey(), values);
return new MultiSortedDocValues(values, starts, mapping);
}
}
@ -222,6 +222,8 @@ public class MultiDocValues {
/** maps per-segment ordinals to/from global ordinal space */
// TODO: use more efficient packed ints structures (these are all positive values!)
static class OrdinalMap {
// cache key of whoever asked for this aweful thing
final Object owner;
// globalOrd -> (globalOrd - segmentOrd)
final AppendingLongBuffer globalOrdDeltas;
// globalOrd -> sub index
@ -229,9 +231,10 @@ public class MultiDocValues {
// segmentOrd -> (globalOrd - segmentOrd)
final AppendingLongBuffer ordDeltas[];
OrdinalMap(SortedDocValues subs[]) throws IOException {
OrdinalMap(Object owner, SortedDocValues subs[]) throws IOException {
// create the ordinal mappings by pulling a termsenum over each sub's
// unique terms, and walking a multitermsenum over those
this.owner = owner;
globalOrdDeltas = new AppendingLongBuffer();
subIndexes = new AppendingLongBuffer();
ordDeltas = new AppendingLongBuffer[subs.length];

View File

@ -106,14 +106,13 @@ public final class SlowCompositeReaderWrapper extends AtomicReader {
SortedDocValues dv = MultiDocValues.getSortedValues(in, field);
if (dv instanceof MultiSortedDocValues) {
map = ((MultiSortedDocValues)dv).mapping;
cachedOrdMaps.put(field, map);
if (map.owner == getCoreCacheKey()) {
cachedOrdMaps.put(field, map);
}
}
return dv;
}
}
if (true) { // nocommit
return MultiDocValues.getSortedValues(in, field);
}
// cached multi dv
assert map != null;
int size = in.leaves().size();