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

View File

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