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 2013/02/06 00:09:31 UTC

svn commit: r1442789 - in /lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index: MultiDocValues.java SlowCompositeReaderWrapper.java

Author: rmuir
Date: Tue Feb  5 23:09:30 2013
New Revision: 1442789

URL: http://svn.apache.org/viewvc?rev=1442789&view=rev
Log:
re-enable horrible caching

Modified:
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java?rev=1442789&r1=1442788&r2=1442789&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java Tue Feb  5 23:09:30 2013
@@ -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];

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java?rev=1442789&r1=1442788&r2=1442789&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java Tue Feb  5 23:09:30 2013
@@ -106,14 +106,13 @@ public final class SlowCompositeReaderWr
         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();