incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [32/47] git commit: Project now compiles with lucene 3.6.1, there are still a couple of broken unit tests.
Date Mon, 03 Sep 2012 00:32:20 GMT
Project now compiles with lucene 3.6.1, there are still a couple of broken unit tests.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/dc9c1ac1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/dc9c1ac1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/dc9c1ac1

Branch: refs/heads/master
Commit: dc9c1ac1c51879800e5edbe32ce877e151c4c035
Parents: 9cd32ca
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Aug 21 17:35:41 2012 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Aug 21 17:35:41 2012 -0400

----------------------------------------------------------------------
 .../nearinfinity/blur/manager/IndexManager.java    |    9 +-
 .../clusterstatus/ZookeeperClusterStatus.java      |   11 +-
 .../indexserver/DefaultBlurIndexWarmup.java        |   12 +-
 .../indexserver/DistributedIndexServer.java        |   14 +-
 .../blur/manager/indexserver/LocalIndexServer.java |    4 -
 .../blur/manager/writer/BlurNRTIndex.java          |  112 ++---
 .../blur/manager/writer/TransactionRecorder.java   |   10 +-
 .../manager/writer/lucene/SnapshotIndexReader.java |   12 +-
 .../writer/lucene/SoftDeleteIndexReader.java       |   12 +-
 .../blur/manager/writer/nrt/NRTManager.java        |  410 ---------------
 .../blur/manager/writer/nrt/SearcherManager.java   |  261 ---------
 .../com/nearinfinity/blur/utils/PrimeDocCache.java |    6 +-
 .../java/com/nearinfinity/blur/MiniCluster.java    |   23 +-
 .../blur/manager/writer/BlurNRTIndexTest.java      |    3 +-
 .../nearinfinity/blur/thrift/BlurClusterTest.java  |   75 +++
 src/blur-store/pom.xml                             |    2 +-
 .../nearinfinity/blur/lucene/EscapeRewrite.java    |  197 +++-----
 .../apache/lucene/index/WarmUpByFieldBounds.java   |   10 +-
 18 files changed, 268 insertions(+), 915 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/manager/IndexManager.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/IndexManager.java b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/IndexManager.java
index 7b669b7..9a25962 100644
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/IndexManager.java
+++ b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/IndexManager.java
@@ -49,8 +49,9 @@ import org.apache.lucene.document.Document;
 import org.apache.lucene.document.FieldSelector;
 import org.apache.lucene.document.FieldSelectorResult;
 import org.apache.lucene.index.CorruptIndexException;
+import org.apache.lucene.index.FieldInfo;
+import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexReader.FieldOption;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
 import org.apache.lucene.index.TermEnum;
@@ -63,6 +64,7 @@ import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.util.ReaderUtil;
 
 import com.nearinfinity.blur.concurrent.Executors;
 import com.nearinfinity.blur.log.Log;
@@ -596,8 +598,9 @@ public class IndexManager {
     for (BlurIndex blurIndex : blurIndexes.values()) {
       IndexReader reader = blurIndex.getIndexReader();
       try {
-        Collection<String> fieldNames = reader.getFieldNames(FieldOption.ALL);
-        for (String fieldName : fieldNames) {
+        FieldInfos mergedFieldInfos = ReaderUtil.getMergedFieldInfos(reader);
+        for (FieldInfo fieldInfo : mergedFieldInfos) {
+          String fieldName = fieldInfo.name;
           int index = fieldName.indexOf('.');
           if (index > 0) {
             String columnFamily = fieldName.substring(0, index);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/manager/clusterstatus/ZookeeperClusterStatus.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/clusterstatus/ZookeeperClusterStatus.java b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/clusterstatus/ZookeeperClusterStatus.java
index 6826665..3d52e3a 100644
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/clusterstatus/ZookeeperClusterStatus.java
+++ b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/clusterstatus/ZookeeperClusterStatus.java
@@ -670,11 +670,14 @@ public class ZookeeperClusterStatus extends ClusterStatus {
     long s = System.nanoTime();
     try {
       checkIfOpen();
-      if (tableDescriptor.compressionClass == null) {
-        tableDescriptor.compressionClass = DeflateCodec.class.getName();
+      if (tableDescriptor.getCompressionClass() == null) {
+        tableDescriptor.setCompressionClass(DeflateCodec.class.getName());
       }
-      if (tableDescriptor.similarityClass == null) {
-        tableDescriptor.similarityClass = FairSimilarity.class.getName();
+      if (tableDescriptor.getSimilarityClass() == null) {
+        tableDescriptor.setSimilarityClass(FairSimilarity.class.getName());
+      }
+      if (tableDescriptor.getAnalyzerDefinition() == null) {
+        tableDescriptor.setAnalyzerDefinition(new AnalyzerDefinition());
       }
       String table = BlurUtil.nullCheck(tableDescriptor.name, "tableDescriptor.name cannot be null.");
       String cluster = BlurUtil.nullCheck(tableDescriptor.cluster, "tableDescriptor.cluster cannot be null.");

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/DefaultBlurIndexWarmup.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/DefaultBlurIndexWarmup.java b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/DefaultBlurIndexWarmup.java
index 04c8be4..b748556 100644
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/DefaultBlurIndexWarmup.java
+++ b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/DefaultBlurIndexWarmup.java
@@ -5,11 +5,13 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.lucene.index.FieldInfo;
+import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexReader.FieldOption;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.WarmUpByFieldBounds;
 import org.apache.lucene.index.WarmUpByFieldBoundsStatus;
+import org.apache.lucene.util.ReaderUtil;
 
 import com.nearinfinity.blur.log.Log;
 import com.nearinfinity.blur.log.LogFactory;
@@ -32,7 +34,13 @@ public class DefaultBlurIndexWarmup extends BlurIndexWarmup {
       }
       if (preCacheCols == null) {
         LOG.info("No pre cache defined, precache all fields.");
-        preCacheCols = new ArrayList<String>(reader.getFieldNames(FieldOption.INDEXED));
+        FieldInfos fieldInfos = ReaderUtil.getMergedFieldInfos(reader);
+        preCacheCols = new ArrayList<String>();
+        for (FieldInfo fieldInfo : fieldInfos) {
+          if (fieldInfo.isIndexed) {
+            preCacheCols.add(fieldInfo.name);
+          }
+        }
         preCacheCols.remove(BlurConstants.ROW_ID);
         preCacheCols.remove(BlurConstants.RECORD_ID);
         preCacheCols.remove(BlurConstants.PRIME_DOC);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/DistributedIndexServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/DistributedIndexServer.java b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/DistributedIndexServer.java
index 3873d9c..30a395c 100644
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/DistributedIndexServer.java
+++ b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/DistributedIndexServer.java
@@ -30,12 +30,14 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.compress.CompressionCodec;
+import org.apache.lucene.index.FieldInfo;
+import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.IndexDeletionPolicy;
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexReader.FieldOption;
 import org.apache.lucene.index.TermDocs;
 import org.apache.lucene.index.TermPositions;
 import org.apache.lucene.search.Similarity;
+import org.apache.lucene.util.ReaderUtil;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.ZooDefs.Ids;
@@ -502,7 +504,6 @@ public class DistributedIndexServer extends AbstractIndexServer {
       BlurNRTIndex writer = new BlurNRTIndex();
       writer.setAnalyzer(getAnalyzer(table));
       writer.setDirectory(dir);
-      writer.setExecutorService(_openerService);
       writer.setShard(shard);
       writer.setTable(table);
       writer.setSimilarity(getSimilarity(table));
@@ -544,9 +545,14 @@ public class DistributedIndexServer extends AbstractIndexServer {
     }
     int maxDoc = reader.maxDoc();
     int numDocs = reader.numDocs();
-    Collection<String> fieldNames = reader.getFieldNames(FieldOption.ALL);
+    FieldInfos fieldInfos = ReaderUtil.getMergedFieldInfos(reader);
+    Collection<String> fieldNames = new ArrayList<String>();
+    for (FieldInfo fieldInfo : fieldInfos) {
+      if (fieldInfo.isIndexed) {
+        fieldNames.add(fieldInfo.name);
+      }
+    }
     int primeDocCount = reader.docFreq(BlurConstants.PRIME_DOC_TERM);
-
     TermDocs termDocs = reader.termDocs(BlurConstants.PRIME_DOC_TERM);
     termDocs.next();
     termDocs.close();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/LocalIndexServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/LocalIndexServer.java b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/LocalIndexServer.java
index 3c252c9..bcdb196 100644
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/LocalIndexServer.java
+++ b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/indexserver/LocalIndexServer.java
@@ -30,8 +30,6 @@ import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
@@ -65,7 +63,6 @@ public class LocalIndexServer extends AbstractIndexServer {
   private BlurIndexCloser _closer;
   private int _blockSize = 65536;
   private CompressionCodec _compression = CompressedFieldDataDirectory.DEFAULT_COMPRESSION;
-  private ExecutorService _executorService = Executors.newCachedThreadPool();
   private Path _walPath;
   private Configuration _configuration = new Configuration();
 
@@ -150,7 +147,6 @@ public class LocalIndexServer extends AbstractIndexServer {
     BlurNRTIndex index = new BlurNRTIndex();
     index.setAnalyzer(getAnalyzer(table));
     index.setDirectory(DirectIODirectory.wrap(dir));
-    index.setExecutorService(_executorService);
     index.setShard(shard);
     index.setSimilarity(getSimilarity(table));
     index.setTable(table);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/BlurNRTIndex.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/BlurNRTIndex.java b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/BlurNRTIndex.java
index 61c966a..a7c62cd 100644
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/BlurNRTIndex.java
+++ b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/BlurNRTIndex.java
@@ -4,7 +4,6 @@ import static com.nearinfinity.blur.lucene.LuceneConstant.LUCENE_VERSION;
 
 import java.io.IOException;
 import java.util.List;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
@@ -17,7 +16,10 @@ import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.TieredMergePolicy;
 import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.SearcherWarmer;
+import org.apache.lucene.search.NRTManager;
+import org.apache.lucene.search.NRTManager.TrackingIndexWriter;
+import org.apache.lucene.search.NRTManagerReopenThread;
+import org.apache.lucene.search.SearcherFactory;
 import org.apache.lucene.search.Similarity;
 import org.apache.lucene.store.Directory;
 
@@ -25,11 +27,8 @@ import com.nearinfinity.blur.analysis.BlurAnalyzer;
 import com.nearinfinity.blur.index.IndexWriter;
 import com.nearinfinity.blur.log.Log;
 import com.nearinfinity.blur.log.LogFactory;
-import com.nearinfinity.blur.manager.writer.nrt.NRTManager;
-import com.nearinfinity.blur.manager.writer.nrt.SearcherManager;
 import com.nearinfinity.blur.thrift.generated.Record;
 import com.nearinfinity.blur.thrift.generated.Row;
-import com.nearinfinity.blur.utils.PrimeDocCache;
 
 public class BlurNRTIndex extends BlurIndex {
 
@@ -37,7 +36,6 @@ public class BlurNRTIndex extends BlurIndex {
   private static final boolean APPLY_ALL_DELETES = true;
 
   private NRTManager _nrtManager;
-  private SearcherManager _manager;
   private AtomicBoolean _isClosed = new AtomicBoolean();
   private IndexWriter _writer;
   private Thread _committer;
@@ -45,11 +43,9 @@ public class BlurNRTIndex extends BlurIndex {
   // externally set
   private BlurAnalyzer _analyzer;
   private Directory _directory;
-  private ExecutorService _executorService;
   private String _table;
   private String _shard;
   private Similarity _similarity;
-  private volatile long _lastRefresh;
   private Thread _refresher;
   private TransactionRecorder _recorder;
   private Configuration _configuration;
@@ -59,27 +55,25 @@ public class BlurNRTIndex extends BlurIndex {
   private AtomicReference<IndexReader> _indexRef = new AtomicReference<IndexReader>();
   private long _timeBetweenCommits = TimeUnit.SECONDS.toMillis(60);
   private long _timeBetweenRefreshs = TimeUnit.MILLISECONDS.toMillis(500);
-  private long _timeBetweenRefreshsNano;
   private DirectoryReferenceFileGC _gc;
-  private SearcherWarmer _warmer = new SearcherWarmer() {
-    @Override
-    public void warm(IndexSearcher s) throws IOException {
-      IndexReader indexReader = s.getIndexReader();
-      IndexReader[] subReaders = indexReader.getSequentialSubReaders();
-      if (subReaders == null) {
-        PrimeDocCache.getPrimeDocBitSet(indexReader);
-      } else {
-        for (IndexReader reader : subReaders) {
-          PrimeDocCache.getPrimeDocBitSet(reader);
-        }
-      }
-    }
-  };
+  private TrackingIndexWriter _trackingWriter;
+  private SearcherFactory _searcherFactory = new SearcherFactory();
+//  private SearcherWarmer _warmer = new SearcherWarmer() {
+//    @Override
+//    public void warm(IndexSearcher s) throws IOException {
+//      IndexReader indexReader = s.getIndexReader();
+//      IndexReader[] subReaders = indexReader.getSequentialSubReaders();
+//      if (subReaders == null) {
+//        PrimeDocCache.getPrimeDocBitSet(indexReader);
+//      } else {
+//        for (IndexReader reader : subReaders) {
+//          PrimeDocCache.getPrimeDocBitSet(reader);
+//        }
+//      }
+//    }
+//  };
 
   public void init() throws IOException {
-
-    _timeBetweenRefreshsNano = TimeUnit.MILLISECONDS.toNanos(_timeBetweenRefreshs);
-
     Path walTablePath = new Path(_walPath, _table);
     Path walShardPath = new Path(walTablePath, _shard);
 
@@ -100,43 +94,22 @@ public class BlurNRTIndex extends BlurIndex {
     _recorder.setAnalyzer(_analyzer);
     _recorder.setConfiguration(_configuration);
     _recorder.setWalPath(walShardPath);
-
     _recorder.init();
     _recorder.replay(_writer);
-
-    _nrtManager = new NRTManager(_writer, _executorService, _warmer, APPLY_ALL_DELETES);
-    _manager = _nrtManager.getSearcherManager(APPLY_ALL_DELETES);
-    _lastRefresh = System.nanoTime();
-    IndexSearcher searcher = _manager.acquire();
+    
+    _trackingWriter = new TrackingIndexWriter(_writer);
+    _nrtManager = new NRTManager(_trackingWriter, _searcherFactory, APPLY_ALL_DELETES);
+    IndexSearcher searcher = _nrtManager.acquire();
     _indexRef.set(searcher.getIndexReader());
     startCommiter();
     startRefresher();
   }
 
-  private void startRefresher() {
-    _refresher = new Thread(new Runnable() {
-      @Override
-      public void run() {
-        while (!_isClosed.get()) {
-          try {
-            LOG.debug("Refreshing of [{0}/{1}].", _table, _shard);
-            maybeReopen();
-          } catch (IOException e) {
-            LOG.error("Error during refresh of [{0}/{1}].", _table, _shard, e);
-          }
-          try {
-            Thread.sleep(_timeBetweenRefreshs);
-          } catch (InterruptedException e) {
-            if (_isClosed.get()) {
-              return;
-            }
-            LOG.error("Unknown error with refresher thread [{0}/{1}].", e, _table, _shard);
-          }
-        }
-      }
-    });
-    _refresher.setDaemon(true);
+  private void startRefresher() {    
+    double targetMinStaleSec = _timeBetweenRefreshs / 1000.0;
+    _refresher = new NRTManagerReopenThread(_nrtManager, targetMinStaleSec * 10, targetMinStaleSec);
     _refresher.setName("Refresh Thread [" + _table + "/" + _shard + "]");
+    _refresher.setDaemon(true);
     _refresher.start();
   }
 
@@ -176,13 +149,13 @@ public class BlurNRTIndex extends BlurIndex {
       deleteRow(waitToBeVisible, wal, row.id);
       return;
     }
-    long generation = _recorder.replaceRow(wal, row, _nrtManager);
+    long generation = _recorder.replaceRow(wal, row, _trackingWriter);
     waitToBeVisible(waitToBeVisible, generation);
   }
 
   @Override
   public void deleteRow(boolean waitToBeVisible, boolean wal, String rowId) throws IOException {
-    long generation = _recorder.deleteRow(wal, rowId, _nrtManager);
+    long generation = _recorder.deleteRow(wal, rowId, _trackingWriter);
     waitToBeVisible(waitToBeVisible, generation);
   }
 
@@ -205,7 +178,6 @@ public class BlurNRTIndex extends BlurIndex {
     try {
       _recorder.close();
       _writer.close();
-      _manager.close();
       _closer.close(_indexRef.get());
       _nrtManager.close();
     } finally {
@@ -215,7 +187,7 @@ public class BlurNRTIndex extends BlurIndex {
 
   @Override
   public void refresh() throws IOException {
-    _nrtManager.maybeReopen(APPLY_ALL_DELETES);
+    _nrtManager.maybeRefresh();
   }
 
   @Override
@@ -231,32 +203,18 @@ public class BlurNRTIndex extends BlurIndex {
   private void waitToBeVisible(boolean waitToBeVisible, long generation) throws IOException {
     if (waitToBeVisible) {
       // if visibility is required then reopen.
-      _nrtManager.maybeReopen(true);
-      _manager = _nrtManager.waitForGeneration(generation, APPLY_ALL_DELETES);
+      _nrtManager.waitForGeneration(generation);
       swap();
-    } else {
-      // if not, then check to see if reopened is needed.
-      maybeReopen();
     }
   }
 
   private void swap() {
-    IndexSearcher searcher = _manager.acquire();
+    IndexSearcher searcher = _nrtManager.acquire();
     IndexReader indexReader = searcher.getIndexReader();
     IndexReader oldIndexReader = _indexRef.getAndSet(indexReader);
-    _lastRefresh = System.nanoTime();
     _closer.close(oldIndexReader);
   }
 
-  private void maybeReopen() throws IOException {
-    if (_lastRefresh + _timeBetweenRefreshsNano < System.nanoTime()) {
-      if (_nrtManager.maybeReopen(true)) {
-        swap();
-        LOG.debug("Refreshing index [{0}]", this);
-      }
-    }
-  }
-
   public void setAnalyzer(BlurAnalyzer analyzer) {
     _analyzer = analyzer;
   }
@@ -265,10 +223,6 @@ public class BlurNRTIndex extends BlurIndex {
     _directory = directory;
   }
 
-  public void setExecutorService(ExecutorService executorService) {
-    _executorService = executorService;
-  }
-
   public void setTable(String table) {
     _table = table;
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/TransactionRecorder.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/TransactionRecorder.java b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/TransactionRecorder.java
index d7b55c7..43ac7d4 100644
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/TransactionRecorder.java
+++ b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/TransactionRecorder.java
@@ -25,12 +25,12 @@ import org.apache.lucene.document.Field.Index;
 import org.apache.lucene.document.Field.Store;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.search.NRTManager.TrackingIndexWriter;
 
 import com.nearinfinity.blur.analysis.BlurAnalyzer;
 import com.nearinfinity.blur.index.IndexWriter;
 import com.nearinfinity.blur.log.Log;
 import com.nearinfinity.blur.log.LogFactory;
-import com.nearinfinity.blur.manager.writer.nrt.NRTManager;
 import com.nearinfinity.blur.thrift.generated.Column;
 import com.nearinfinity.blur.thrift.generated.Record;
 import com.nearinfinity.blur.thrift.generated.Row;
@@ -246,7 +246,7 @@ public class TransactionRecorder {
     }
   }
 
-  public long replaceRow(boolean wal, Row row, NRTManager nrtManager) throws IOException {
+  public long replaceRow(boolean wal, Row row, TrackingIndexWriter writer) throws IOException {
     synchronized (running) {
       if (wal) {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -256,11 +256,11 @@ public class TransactionRecorder {
         outputStream.close();
         sync(baos.toByteArray());
       }
-      return nrtManager.updateDocuments(ROW_ID.createTerm(row.id), getDocs(row));
+      return writer.updateDocuments(ROW_ID.createTerm(row.id), getDocs(row));
     }
   }
 
-  public long deleteRow(boolean wal, String rowId, NRTManager nrtManager) throws IOException {
+  public long deleteRow(boolean wal, String rowId, TrackingIndexWriter writer) throws IOException {
     synchronized (running) {
       if (wal) {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -270,7 +270,7 @@ public class TransactionRecorder {
         outputStream.close();
         sync(baos.toByteArray());
       }
-      return nrtManager.deleteDocuments(ROW_ID.createTerm(rowId));
+      return writer.deleteDocuments(ROW_ID.createTerm(rowId));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/lucene/SnapshotIndexReader.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/lucene/SnapshotIndexReader.java b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/lucene/SnapshotIndexReader.java
index a002bcd..8755af7 100644
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/lucene/SnapshotIndexReader.java
+++ b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/lucene/SnapshotIndexReader.java
@@ -69,12 +69,12 @@ public class SnapshotIndexReader extends FilterIndexReader {
     return new SnapshotTermPositions(in.termPositions(), maxDocs);
   }
 
-  public TermPositions termPositions(Term term) throws IOException {
-    ensureOpen();
-    TermPositions termPositions = termPositions();
-    termPositions.seek(term);
-    return termPositions;
-  }
+//  public TermPositions termPositions(Term term) throws IOException {
+//    ensureOpen();
+//    TermPositions termPositions = termPositions();
+//    termPositions.seek(term);
+//    return termPositions;
+//  }
 
   public static class SnapshotTermPositions extends FilterTermPositions {
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/lucene/SoftDeleteIndexReader.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/lucene/SoftDeleteIndexReader.java b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/lucene/SoftDeleteIndexReader.java
index daacf1d..dcdf54b 100644
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/lucene/SoftDeleteIndexReader.java
+++ b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/lucene/SoftDeleteIndexReader.java
@@ -107,12 +107,12 @@ public class SoftDeleteIndexReader extends FilterIndexReader {
     return new SoftDeleteTermPositions(in.termPositions(), deletes);
   }
 
-  public TermPositions termPositions(Term term) throws IOException {
-    ensureOpen();
-    TermPositions termPositions = termPositions();
-    termPositions.seek(term);
-    return termPositions;
-  }
+//  public TermPositions termPositions(Term term) throws IOException {
+//    ensureOpen();
+//    TermPositions termPositions = termPositions();
+//    termPositions.seek(term);
+//    return termPositions;
+//  }
 
   public static class SoftDeleteTermPositions extends FilterTermPositions {
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/nrt/NRTManager.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/nrt/NRTManager.java b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/nrt/NRTManager.java
deleted file mode 100644
index e8570e0..0000000
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/nrt/NRTManager.java
+++ /dev/null
@@ -1,410 +0,0 @@
-package com.nearinfinity.blur.manager.writer.nrt;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.NRTManagerReopenThread;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.SearcherWarmer;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.util.IOUtils;
-import org.apache.lucene.util.ThreadInterruptedException;
-
-/**
- * Utility class to manage sharing near-real-time searchers
- * across multiple searching threads.
- *
- * <p>NOTE: to use this class, you must call {@link #maybeReopen(boolean)}
- * periodically.  The {@link NRTManagerReopenThread} is a
- * simple class to do this on a periodic basis.  If you
- * implement your own reopener, be sure to call {@link
- * #addWaitingListener} so your reopener is notified when a
- * caller is waiting for a specific generation searcher. </p>
- *
- * @lucene.experimental
- */
-
-public class NRTManager implements Closeable {
-  private static final long MAX_SEARCHER_GEN = Long.MAX_VALUE;
-  private final IndexWriter writer;
-  private final SearcherManagerRef withoutDeletes;
-  private final SearcherManagerRef withDeletes;
-  private final AtomicLong indexingGen;
-  private final List<WaitingListener> waitingListeners = new CopyOnWriteArrayList<WaitingListener>();
-  private final ReentrantLock reopenLock = new ReentrantLock();
-  private final Condition newGeneration = reopenLock.newCondition();
-
-  /**
-   * Create new NRTManager.
-   * 
-   *  @param writer IndexWriter to open near-real-time
-   *         readers
-   *  @param warmer optional {@link SearcherWarmer}.  Pass
-   *         null if you don't require the searcher to warmed
-   *         before going live.  If this is non-null then a
-   *         merged segment warmer is installed on the
-   *         provided IndexWriter's config.
-   *
-   *  <p><b>NOTE</b>: the provided {@link SearcherWarmer} is
-   *  not invoked for the initial searcher; you should
-   *  warm it yourself if necessary.
-   */
-  public NRTManager(IndexWriter writer, SearcherWarmer warmer) throws IOException {
-    this(writer, null, warmer, true);
-  }
-
-  /**
-   * Create new NRTManager.
-   * 
-   *  @param writer IndexWriter to open near-real-time
-   *         readers
-   *  @param es optional ExecutorService so different segments can
-   *         be searched concurrently (see {@link IndexSearcher#IndexSearcher(IndexReader, ExecutorService)}.
-   *         Pass <code>null</code> to search segments sequentially.
-   *  @param warmer optional {@link SearcherWarmer}.  Pass
-   *         null if you don't require the searcher to warmed
-   *         before going live.  If this is non-null then a
-   *         merged segment warmer is installed on the
-   *         provided IndexWriter's config.
-   *
-   *  <p><b>NOTE</b>: the provided {@link SearcherWarmer} is
-   *  not invoked for the initial searcher; you should
-   *  warm it yourself if necessary.
-   */
-  public NRTManager(IndexWriter writer, ExecutorService es,
-      SearcherWarmer warmer) throws IOException {
-    this(writer, es, warmer, true);
-  }
-
-  /**
-   * Expert: just like {@link
-   * #NRTManager(IndexWriter,ExecutorService,SearcherWarmer)},
-   * but you can also specify whether every searcher must
-   * apply deletes.  This is useful for cases where certain
-   * uses can tolerate seeing some deleted docs, since
-   * reopen time is faster if deletes need not be applied. */
-  public NRTManager(IndexWriter writer, ExecutorService es,
-      SearcherWarmer warmer, boolean alwaysApplyDeletes) throws IOException {
-    this.writer = writer;
-    if (alwaysApplyDeletes) {
-      withoutDeletes = withDeletes = new SearcherManagerRef(true, 0,  new SearcherManager(writer, true, warmer, es));
-    } else {
-      withDeletes = new SearcherManagerRef(true, 0, new SearcherManager(writer, true, warmer, es));
-      withoutDeletes = new SearcherManagerRef(false, 0, new SearcherManager(writer, false, warmer, es));
-    }
-    indexingGen = new AtomicLong(1);
-  }
-  
-  /** NRTManager invokes this interface to notify it when a
-   *  caller is waiting for a specific generation searcher
-   *  to be visible. */
-  public static interface WaitingListener {
-    public void waiting(boolean requiresDeletes, long targetGen);
-  }
-
-  /** Adds a listener, to be notified when a caller is
-   *  waiting for a specific generation searcher to be
-   *  visible. */
-  public void addWaitingListener(WaitingListener l) {
-    waitingListeners.add(l);
-  }
-
-  /** Remove a listener added with {@link
-   *  #addWaitingListener}. */
-  public void removeWaitingListener(WaitingListener l) {
-    waitingListeners.remove(l);
-  }
-
-  public long updateDocument(Term t, Document d, Analyzer a) throws IOException {
-    writer.updateDocument(t, d, a);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long updateDocument(Term t, Document d) throws IOException {
-    writer.updateDocument(t, d);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long updateDocuments(Term t, Collection<Document> docs, Analyzer a) throws IOException {
-    writer.updateDocuments(t, docs, a);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long updateDocuments(Term t, Collection<Document> docs) throws IOException {
-    writer.updateDocuments(t, docs);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long deleteDocuments(Term t) throws IOException {
-    writer.deleteDocuments(t);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long deleteDocuments(Term... terms) throws IOException {
-    writer.deleteDocuments(terms);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long deleteDocuments(Query q) throws IOException {
-    writer.deleteDocuments(q);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long deleteDocuments(Query... queries) throws IOException {
-    writer.deleteDocuments(queries);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long deleteAll() throws IOException {
-    writer.deleteAll();
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long addDocument(Document d, Analyzer a) throws IOException {
-    writer.addDocument(d, a);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long addDocuments(Collection<Document> docs, Analyzer a) throws IOException {
-    writer.addDocuments(docs, a);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long addDocument(Document d) throws IOException {
-    writer.addDocument(d);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long addDocuments(Collection<Document> docs) throws IOException {
-    writer.addDocuments(docs);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long addIndexes(Directory... dirs) throws CorruptIndexException, IOException {
-    writer.addIndexes(dirs);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  public long addIndexes(IndexReader... readers) throws CorruptIndexException, IOException {
-    writer.addIndexes(readers);
-    // Return gen as of when indexing finished:
-    return indexingGen.get();
-  }
-
-  /**
-   * Waits for a given {@link SearcherManager} target generation to be available
-   * via {@link #getSearcherManager(boolean)}. If the current generation is less
-   * than the given target generation this method will block until the
-   * correspondent {@link SearcherManager} is reopened by another thread via
-   * {@link #maybeReopen(boolean)} or until the {@link NRTManager} is closed.
-   * 
-   * @param targetGen the generation to wait for
-   * @param requireDeletes <code>true</code> iff the generation requires deletes to be applied otherwise <code>false</code>
-   * @return the {@link SearcherManager} with the given target generation
-   */
-  public SearcherManager waitForGeneration(long targetGen, boolean requireDeletes) {
-    return waitForGeneration(targetGen, requireDeletes, -1,  TimeUnit.NANOSECONDS);
-  }
-
-  /**
-   * Waits for a given {@link SearcherManager} target generation to be available
-   * via {@link #getSearcherManager(boolean)}. If the current generation is less
-   * than the given target generation this method will block until the
-   * correspondent {@link SearcherManager} is reopened by another thread via
-   * {@link #maybeReopen(boolean)}, the given waiting time has elapsed, or until
-   * the {@link NRTManager} is closed.
-   * <p>
-   * NOTE: if the waiting time elapses before the requested target generation is
-   * available the latest {@link SearcherManager} is returned instead.
-   * 
-   * @param targetGen
-   *          the generation to wait for
-   * @param requireDeletes
-   *          <code>true</code> iff the generation requires deletes to be
-   *          applied otherwise <code>false</code>
-   * @param time
-   *          the time to wait for the target generation
-   * @param unit
-   *          the waiting time's time unit
-   * @return the {@link SearcherManager} with the given target generation or the
-   *         latest {@link SearcherManager} if the waiting time elapsed before
-   *         the requested generation is available.
-   */
-  public SearcherManager waitForGeneration(long targetGen, boolean requireDeletes, long time, TimeUnit unit) {
-    try {
-      final long curGen = indexingGen.get();
-      if (targetGen > curGen) {
-        throw new IllegalArgumentException("targetGen=" + targetGen + " was never returned by this NRTManager instance (current gen=" + curGen + ")");
-      }
-      reopenLock.lockInterruptibly();
-      try {
-        if (targetGen > getCurrentSearchingGen(requireDeletes)) {
-          for (WaitingListener listener : waitingListeners) {
-            listener.waiting(requireDeletes, targetGen);
-          }
-          while (targetGen > getCurrentSearchingGen(requireDeletes)) {
-            if (!waitOnGenCondition(time, unit)) {
-              return getSearcherManager(requireDeletes);
-            }
-          }
-        }
-
-      } finally {
-        reopenLock.unlock();
-      }
-    } catch (InterruptedException ie) {
-      throw new ThreadInterruptedException(ie);
-    }
-    return getSearcherManager(requireDeletes);
-  }
-  
-  private boolean waitOnGenCondition(long time, TimeUnit unit)
-      throws InterruptedException {
-    assert reopenLock.isHeldByCurrentThread();
-    if (time < 0) {
-      newGeneration.await();
-      return true;
-    } else {
-      return newGeneration.await(time, unit);
-    }
-  }
-
-  /** Returns generation of current searcher. */
-  public long getCurrentSearchingGen(boolean applyAllDeletes) {
-    if (applyAllDeletes) {
-      return withDeletes.generation;
-    } else {
-      return Math.max(withoutDeletes.generation, withDeletes.generation);
-    }
-  }
-
-  public boolean maybeReopen(boolean applyAllDeletes) throws IOException {
-    if (reopenLock.tryLock()) {
-      try {
-        final SearcherManagerRef reference = applyAllDeletes ? withDeletes : withoutDeletes;
-        // Mark gen as of when reopen started:
-        final long newSearcherGen = indexingGen.getAndIncrement();
-        boolean setSearchGen = false;
-        if (reference.generation == MAX_SEARCHER_GEN) {
-          newGeneration.signalAll(); // wake up threads if we have a new generation
-          return false;
-        }
-        if (!(setSearchGen = reference.manager.isSearcherCurrent())) {
-          setSearchGen = reference.manager.maybeReopen();
-        }
-        if (setSearchGen) {
-          reference.generation = newSearcherGen;// update searcher gen
-          newGeneration.signalAll(); // wake up threads if we have a new generation
-        }
-        return setSearchGen;
-      } finally {
-        reopenLock.unlock();
-      }
-    }
-    return false;
-  }
-
-  /**
-   * Close this NRTManager to future searching. Any searches still in process in
-   * other threads won't be affected, and they should still call
-   * {@link SearcherManager#release(IndexSearcher)} after they are done.
-   * 
-   * <p>
-   * <b>NOTE</b>: caller must separately close the writer.
-   */
-  public void close() throws IOException {
-    reopenLock.lock();
-    try {
-      try {
-        IOUtils.close(withDeletes, withoutDeletes);
-      } finally { // make sure we signal even if close throws an exception
-        newGeneration.signalAll();
-      }
-    } finally {
-      reopenLock.unlock();
-      assert withDeletes.generation == MAX_SEARCHER_GEN && withoutDeletes.generation == MAX_SEARCHER_GEN;
-    }
-  }
-
-  /**
-   * Returns a {@link SearcherManager}. If <code>applyAllDeletes</code> is
-   * <code>true</code> the returned manager is guaranteed to have all deletes
-   * applied on the last reopen. Otherwise the latest manager with or without deletes
-   * is returned.
-   */
-  public SearcherManager getSearcherManager(boolean applyAllDeletes) {
-    if (applyAllDeletes) {
-      return withDeletes.manager;
-    } else {
-      if (withDeletes.generation > withoutDeletes.generation) {
-        return withDeletes.manager;
-      } else {
-        return withoutDeletes.manager;
-      }
-    }
-  }
-  
-  static final class SearcherManagerRef implements Closeable {
-    final boolean applyDeletes;
-    volatile long generation;
-    final SearcherManager manager;
-
-    SearcherManagerRef(boolean applyDeletes, long generation, SearcherManager manager) {
-      super();
-      this.applyDeletes = applyDeletes;
-      this.generation = generation;
-      this.manager = manager;
-    }
-    
-    public void close() throws IOException {
-      generation = MAX_SEARCHER_GEN; // max it out to make sure nobody can wait on another gen
-      manager.close();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/nrt/SearcherManager.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/nrt/SearcherManager.java b/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/nrt/SearcherManager.java
deleted file mode 100644
index 9493e8e..0000000
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/manager/writer/nrt/SearcherManager.java
+++ /dev/null
@@ -1,261 +0,0 @@
-package com.nearinfinity.blur.manager.writer.nrt;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.IOException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Semaphore;
-
-import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.NRTManager;
-import org.apache.lucene.search.SearcherWarmer;
-import org.apache.lucene.store.AlreadyClosedException;
-import org.apache.lucene.store.Directory;
-
-/**
- * Utility class to safely share {@link IndexSearcher} instances across multiple
- * threads, while periodically reopening. This class ensures each searcher is
- * closed only once all threads have finished using it.
- * 
- * <p>
- * Use {@link #acquire} to obtain the current searcher, and {@link #release} to
- * release it, like this:
- * 
- * <pre class="prettyprint">
- * IndexSearcher s = manager.acquire();
- * try {
- *   // Do searching, doc retrieval, etc. with s
- * } finally {
- *   manager.release(s);
- * }
- * // Do not use s after this!
- * s = null;
- * </pre>
- * 
- * <p>
- * In addition you should periodically call {@link #maybeReopen}. While it's
- * possible to call this just before running each query, this is discouraged
- * since it penalizes the unlucky queries that do the reopen. It's better to use
- * a separate background thread, that periodically calls maybeReopen. Finally,
- * be sure to call {@link #close} once you are done.
- * 
- * <p>
- * <b>NOTE</b>: if you have an {@link IndexWriter}, it's better to use
- * {@link NRTManager} since that class pulls near-real-time readers from the
- * IndexWriter.
- * 
- * @lucene.experimental
- */
-
-public final class SearcherManager {
-
-  private volatile IndexSearcher currentSearcher;
-  private final ExecutorService es;
-  private final SearcherWarmer warmer;
-  private final Semaphore reopenLock = new Semaphore(1);
-
-  /**
-   * Creates and returns a new SearcherManager from the given
-   * {@link IndexWriter}.
-   * 
-   * @param writer
-   *          the IndexWriter to open the IndexReader from.
-   * @param applyAllDeletes
-   *          If <code>true</code>, all buffered deletes will be applied (made
-   *          visible) in the {@link IndexSearcher} / {@link IndexReader}. If
-   *          <code>false</code>, the deletes may or may not be applied, but
-   *          remain buffered (in IndexWriter) so that they will be applied in
-   *          the future. Applying deletes can be costly, so if your app can
-   *          tolerate deleted documents being returned you might gain some
-   *          performance by passing <code>false</code>. See
-   *          {@link IndexReader#openIfChanged(IndexReader, IndexWriter, boolean)}
-   *          .
-   * @param warmer
-   *          An optional {@link SearcherWarmer}. Pass <code>null</code> if you
-   *          don't require the searcher to warmed before going live. If this is
-   *          <code>non-null</code> then a merged segment warmer is installed on
-   *          the provided IndexWriter's config.
-   * @param es
-   *          An optional {@link ExecutorService} so different segments can be
-   *          searched concurrently (see
-   *          {@link IndexSearcher#IndexSearcher(IndexReader,ExecutorService)}.
-   *          Pass <code>null</code> to search segments sequentially.
-   * 
-   * @throws IOException
-   */
-  public SearcherManager(IndexWriter writer, boolean applyAllDeletes, final SearcherWarmer warmer, final ExecutorService es) throws IOException {
-    this.es = es;
-    this.warmer = warmer;
-    currentSearcher = new IndexSearcher(IndexReader.open(writer, applyAllDeletes));
-    if (warmer != null) {
-      writer.getConfig().setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() {
-        @Override
-        public void warm(IndexReader reader) throws IOException {
-          warmer.warm(new IndexSearcher(reader, es));
-        }
-      });
-    }
-  }
-
-  /**
-   * Creates and returns a new SearcherManager from the given {@link Directory}.
-   * 
-   * @param dir
-   *          the directory to open the IndexReader on.
-   * @param warmer
-   *          An optional {@link SearcherWarmer}. Pass <code>null</code> if you
-   *          don't require the searcher to warmed before going live. If this is
-   *          <code>non-null</code> then a merged segment warmer is installed on
-   *          the provided IndexWriter's config.
-   * @param es
-   *          And optional {@link ExecutorService} so different segments can be
-   *          searched concurrently (see
-   *          {@link IndexSearcher#IndexSearcher(IndexReader,ExecutorService)}.
-   *          Pass <code>null</code> to search segments sequentially.
-   * 
-   * @throws IOException
-   */
-  public SearcherManager(Directory dir, SearcherWarmer warmer, ExecutorService es) throws IOException {
-    this.es = es;
-    this.warmer = warmer;
-    currentSearcher = new IndexSearcher(IndexReader.open(dir, true), es);
-  }
-
-  /**
-   * You must call this, periodically, to perform a reopen. This calls
-   * {@link IndexReader#openIfChanged(IndexReader)} with the underlying reader,
-   * and if that returns a new reader, it's warmed (if you provided a
-   * {@link SearcherWarmer} and then swapped into production.
-   * 
-   * <p>
-   * <b>Threads</b>: it's fine for more than one thread to call this at once.
-   * Only the first thread will attempt the reopen; subsequent threads will see
-   * that another thread is already handling reopen and will return immediately.
-   * Note that this means if another thread is already reopening then subsequent
-   * threads will return right away without waiting for the reader reopen to
-   * complete.
-   * </p>
-   * 
-   * <p>
-   * This method returns true if a new reader was in fact opened or if the
-   * current searcher has no pending changes.
-   * </p>
-   */
-  public boolean maybeReopen() throws IOException {
-    ensureOpen();
-    // Ensure only 1 thread does reopen at once; other
-    // threads just return immediately:
-    if (reopenLock.tryAcquire()) {
-      try {
-        // IR.openIfChanged preserves NRT and applyDeletes
-        // in the newly returned reader:
-        final IndexReader newReader = IndexReader.openIfChanged(currentSearcher.getIndexReader());
-        if (newReader != null) {
-          final IndexSearcher newSearcher = new IndexSearcher(newReader, es);
-          boolean success = false;
-          try {
-            if (warmer != null) {
-              warmer.warm(newSearcher);
-            }
-            swapSearcher(newSearcher);
-            success = true;
-            return success;
-          } finally {
-            if (!success) {
-              release(newSearcher);
-            }
-          }
-        }
-      } finally {
-        reopenLock.release();
-      }
-    }
-    return false;
-  }
-
-  /**
-   * Returns <code>true</code> if no changes have occured since this searcher
-   * ie. reader was opened, otherwise <code>false</code>.
-   * 
-   * @see IndexReader#isCurrent()
-   */
-  public boolean isSearcherCurrent() throws CorruptIndexException, IOException {
-    final IndexSearcher searcher = acquire();
-    try {
-      return searcher.getIndexReader().isCurrent();
-    } finally {
-      release(searcher);
-    }
-  }
-
-  /**
-   * Release the searcher previously obtained with {@link #acquire}.
-   * 
-   * <p>
-   * <b>NOTE</b>: it's safe to call this after {@link #close}.
-   */
-  public void release(IndexSearcher searcher) throws IOException {
-    assert searcher != null;
-    searcher.getIndexReader().decRef();
-  }
-
-  /**
-   * Close this SearcherManager to future searching. Any searches still in
-   * process in other threads won't be affected, and they should still call
-   * {@link #release} after they are done.
-   */
-  public synchronized void close() throws IOException {
-    if (currentSearcher != null) {
-      // make sure we can call this more than once
-      // closeable javadoc says:
-      // if this is already closed then invoking this method has no effect.
-      swapSearcher(null);
-    }
-  }
-
-  /**
-   * Obtain the current IndexSearcher. You must match every call to acquire with
-   * one call to {@link #release}; it's best to do so in a finally clause.
-   */
-  public IndexSearcher acquire() {
-    IndexSearcher searcher;
-    do {
-      if ((searcher = currentSearcher) == null) {
-        throw new AlreadyClosedException("this SearcherManager is closed");
-      }
-    } while (!searcher.getIndexReader().tryIncRef());
-    return searcher;
-  }
-
-  private void ensureOpen() {
-    if (currentSearcher == null) {
-      throw new AlreadyClosedException("this SearcherManager is closed");
-    }
-  }
-
-  private synchronized void swapSearcher(IndexSearcher newSearcher) throws IOException {
-    ensureOpen();
-    final IndexSearcher oldSearcher = currentSearcher;
-    currentSearcher = newSearcher;
-    release(oldSearcher);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/main/java/com/nearinfinity/blur/utils/PrimeDocCache.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/utils/PrimeDocCache.java b/src/blur-core/src/main/java/com/nearinfinity/blur/utils/PrimeDocCache.java
index 4534de3..3ec05c4 100644
--- a/src/blur-core/src/main/java/com/nearinfinity/blur/utils/PrimeDocCache.java
+++ b/src/blur-core/src/main/java/com/nearinfinity/blur/utils/PrimeDocCache.java
@@ -21,7 +21,7 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexReader.ReaderFinishedListener;
+import org.apache.lucene.index.IndexReader.ReaderClosedListener;
 import org.apache.lucene.index.TermDocs;
 import org.apache.lucene.util.OpenBitSet;
 
@@ -45,9 +45,9 @@ public class PrimeDocCache {
     Object key = reader.getCoreCacheKey();
     OpenBitSet bitSet = primeDocMap.get(key);
     if (bitSet == null) {
-      reader.addReaderFinishedListener(new ReaderFinishedListener() {
+      reader.addReaderClosedListener(new ReaderClosedListener() {
         @Override
-        public void finished(IndexReader reader) {
+        public void onClose(IndexReader reader) {
           Object key = reader.getCoreCacheKey();
           LOG.debug("Current size [" + primeDocMap.size() + "] Prime Doc BitSet removing for segment [" + reader + "]");
           primeDocMap.remove(key);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/test/java/com/nearinfinity/blur/MiniCluster.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/MiniCluster.java b/src/blur-core/src/test/java/com/nearinfinity/blur/MiniCluster.java
index 6f32ab9..de1a9c7 100644
--- a/src/blur-core/src/test/java/com/nearinfinity/blur/MiniCluster.java
+++ b/src/blur-core/src/test/java/com/nearinfinity/blur/MiniCluster.java
@@ -1,6 +1,6 @@
 package com.nearinfinity.blur;
 
-import static com.nearinfinity.blur.utils.BlurConstants.BLUR_SHARD_BLOCKCACHE_DIRECT_MEMORY_ALLOCATION;
+import static com.nearinfinity.blur.utils.BlurConstants.*;
 import static com.nearinfinity.blur.utils.BlurConstants.BLUR_SHARD_BLOCKCACHE_SLAB_COUNT;
 import static com.nearinfinity.blur.utils.BlurConstants.BLUR_ZOOKEEPER_CONNECTION;
 
@@ -66,7 +66,6 @@ public abstract class MiniCluster {
   public static void main(String[] args) throws IOException, InterruptedException, KeeperException, BlurException, TException {
     startDfs("./tmp");
     startZooKeeper("./tmp");
-
     startControllers(1);
     startShards(1);
 
@@ -83,22 +82,35 @@ public abstract class MiniCluster {
         addRow("test", i, client);
       }
 
-      //This waits for all the data to become visible.
+      // This waits for all the data to become visible.
       Thread.sleep(2000);
 
       for (int i = 0; i < 1000; i++) {
         searchRow("test", i, client);
       }
-      
+
     } finally {
       stopShards();
       stopControllers();
-
       shutdownZooKeeper();
       shutdownDfs();
     }
   }
 
+  public static void startBlurCluster(String path, int controllerCount, int shardCount) {
+    startDfs(path);
+    startZooKeeper(path);
+    startControllers(controllerCount);
+    startShards(shardCount);
+  }
+
+  public static void shutdownBlurCluster() {
+    stopShards();
+    stopControllers();
+    shutdownZooKeeper();
+    shutdownDfs();
+  }
+
   private static void createTable(String test, Iface client) throws BlurException, TException, IOException {
     final TableDescriptor descriptor = new TableDescriptor();
     descriptor.setName(test);
@@ -162,6 +174,7 @@ public abstract class MiniCluster {
     configuration.set(BLUR_ZOOKEEPER_CONNECTION, getZkConnectionString());
     configuration.set(BLUR_SHARD_BLOCKCACHE_DIRECT_MEMORY_ALLOCATION, "false");
     configuration.set(BLUR_SHARD_BLOCKCACHE_SLAB_COUNT, "0");
+    configuration.setLong(BLUR_SHARD_SAFEMODEDELAY, 5000);
     return configuration;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/test/java/com/nearinfinity/blur/manager/writer/BlurNRTIndexTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/manager/writer/BlurNRTIndexTest.java b/src/blur-core/src/test/java/com/nearinfinity/blur/manager/writer/BlurNRTIndexTest.java
index 546bf8b..972d512 100644
--- a/src/blur-core/src/test/java/com/nearinfinity/blur/manager/writer/BlurNRTIndexTest.java
+++ b/src/blur-core/src/test/java/com/nearinfinity/blur/manager/writer/BlurNRTIndexTest.java
@@ -59,7 +59,6 @@ public class BlurNRTIndexTest {
     writer.setShard("testing-shard");
     
     service = Executors.newThreadPool("test", 10);
-    writer.setExecutorService(service);
     writer.setWalPath(new Path(new File(base,"wal").toURI()));
     
     writer.setConfiguration(configuration);
@@ -94,6 +93,8 @@ public class BlurNRTIndexTest {
     int total = 0;
     for (int i = 0; i < TEST_NUMBER_WAIT_VISIBLE; i++) {
       writer.replaceRow(true, true, genRow());
+      IndexReader reader = writer.getIndexReader();
+      assertEquals(i, reader.numDocs());
       total++;
     }
     long e = System.nanoTime();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurClusterTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurClusterTest.java b/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurClusterTest.java
new file mode 100644
index 0000000..7cca0cf
--- /dev/null
+++ b/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurClusterTest.java
@@ -0,0 +1,75 @@
+package com.nearinfinity.blur.thrift;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.thrift.TException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.nearinfinity.blur.MiniCluster;
+import com.nearinfinity.blur.thrift.generated.Blur;
+import com.nearinfinity.blur.thrift.generated.Blur.Iface;
+import com.nearinfinity.blur.thrift.generated.BlurException;
+import com.nearinfinity.blur.thrift.generated.BlurQuery;
+import com.nearinfinity.blur.thrift.generated.BlurResults;
+import com.nearinfinity.blur.thrift.generated.RecordMutation;
+import com.nearinfinity.blur.thrift.generated.RowMutation;
+import com.nearinfinity.blur.thrift.generated.SimpleQuery;
+import com.nearinfinity.blur.thrift.generated.TableDescriptor;
+import com.nearinfinity.blur.utils.BlurUtil;
+
+public class BlurClusterTest {
+
+  @BeforeClass
+  public static void startCluster() {
+    MiniCluster.startBlurCluster("./tmp/cluster", 2, 3);
+  }
+
+  @AfterClass
+  public static void shutdownCluster() {
+    MiniCluster.shutdownBlurCluster();
+  }
+
+  @Test
+  public void testCreateTable() throws BlurException, TException, IOException {
+    Blur.Iface client = getClient();
+    TableDescriptor tableDescriptor = new TableDescriptor();
+    tableDescriptor.setName("test");
+    tableDescriptor.setShardCount(5);
+    tableDescriptor.setTableUri(MiniCluster.getFileSystemUri().toString() + "/blur/test");
+    client.createTable(tableDescriptor);
+    List<String> tableList = client.tableList();
+    assertEquals(Arrays.asList("test"), tableList);
+  }
+
+  private Iface getClient() {
+    return BlurClient.getClient(MiniCluster.getControllerConnectionStr());
+  }
+
+  @Test
+  public void testLoadTable() throws BlurException, TException, InterruptedException {
+    Iface client = getClient();
+    int length = 100;
+    for (int i = 0; i < length; i++) {
+      String rowId = UUID.randomUUID().toString();
+      RecordMutation mutation = BlurUtil.newRecordMutation("test", rowId, BlurUtil.newColumn("test", "value"));
+      RowMutation rowMutation = BlurUtil.newRowMutation("test", rowId, mutation);
+      if (i == length - 1) {
+        rowMutation.setWaitToBeVisible(true);
+      }
+      client.mutate(rowMutation);
+    }
+    BlurQuery blurQuery = new BlurQuery();
+    SimpleQuery simpleQuery = new SimpleQuery();
+    simpleQuery.setQueryStr("test.test:value");
+    blurQuery.setSimpleQuery(simpleQuery);
+    BlurResults results = client.query("test", blurQuery);
+    assertEquals(length, results.getTotalResults());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-store/pom.xml
----------------------------------------------------------------------
diff --git a/src/blur-store/pom.xml b/src/blur-store/pom.xml
index 1fcca5c..58ae6af 100644
--- a/src/blur-store/pom.xml
+++ b/src/blur-store/pom.xml
@@ -20,7 +20,7 @@
 		<dependency>
 			<groupId>org.apache.lucene</groupId>
 			<artifactId>lucene-core</artifactId>
-			<version>3.5.0.lm</version>
+			<version>3.6.1</version>
 		</dependency>
 		<dependency>
 			<groupId>commons-cli</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-store/src/main/java/com/nearinfinity/blur/lucene/EscapeRewrite.java
----------------------------------------------------------------------
diff --git a/src/blur-store/src/main/java/com/nearinfinity/blur/lucene/EscapeRewrite.java b/src/blur-store/src/main/java/com/nearinfinity/blur/lucene/EscapeRewrite.java
index c8d5584..47c581c 100644
--- a/src/blur-store/src/main/java/com/nearinfinity/blur/lucene/EscapeRewrite.java
+++ b/src/blur-store/src/main/java/com/nearinfinity/blur/lucene/EscapeRewrite.java
@@ -10,8 +10,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.FieldSelector;
 import org.apache.lucene.index.CorruptIndexException;
+import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.IndexCommit;
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.StaleReaderException;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
@@ -69,7 +71,6 @@ public class EscapeRewrite {
     return new IndexReaderRewriteEscape(reader, running);
   }
 
-  @SuppressWarnings("deprecation")
   public static class IndexReaderRewriteEscape extends IndexReader {
     private IndexReader reader;
     private AtomicBoolean running;
@@ -79,84 +80,92 @@ public class EscapeRewrite {
       this.running = running;
     }
 
-    public void addReaderFinishedListener(ReaderFinishedListener listener) {
-      reader.addReaderFinishedListener(listener);
-    }
-
-    public void removeReaderFinishedListener(ReaderFinishedListener listener) {
-      reader.removeReaderFinishedListener(listener);
-    }
-
-    public boolean tryIncRef() {
-      return reader.tryIncRef();
-    }
-
     public String toString() {
       return reader.toString();
     }
 
-    public void decRef() throws IOException {
-      reader.decRef();
+    public IndexReader reopen() throws CorruptIndexException, IOException {
+      return reader.reopen();
     }
 
-    public Object clone() {
-      IndexReaderRewriteEscape clone = (IndexReaderRewriteEscape) super.clone();
-      clone.reader = (IndexReader) reader.clone();
-      return clone;
+    public IndexReader reopen(boolean openReadOnly) throws CorruptIndexException, IOException {
+      return reader.reopen(openReadOnly);
     }
 
-    public IndexReader clone(boolean openReadOnly) throws CorruptIndexException, IOException {
-      IndexReaderRewriteEscape clone = (IndexReaderRewriteEscape) super.clone();
-      clone.reader = reader.clone(openReadOnly);
-      return clone;
+    public IndexReader reopen(IndexCommit commit) throws CorruptIndexException, IOException {
+      return reader.reopen(commit);
+    }
+
+    public IndexReader reopen(IndexWriter writer, boolean applyAllDeletes) throws CorruptIndexException, IOException {
+      return reader.reopen(writer, applyAllDeletes);
     }
 
     public Directory directory() {
       return reader.directory();
     }
 
+    public long getVersion() {
+      return reader.getVersion();
+    }
+
     public boolean isOptimized() {
       return reader.isOptimized();
     }
 
-    public int numDeletedDocs() {
-      return reader.numDeletedDocs();
+    public TermFreqVector[] getTermFreqVectors(int docNumber) throws IOException {
+      return reader.getTermFreqVectors(docNumber);
     }
 
-    public Document document(int n) throws CorruptIndexException, IOException {
-      return reader.document(n);
+    public TermFreqVector getTermFreqVector(int docNumber, String field) throws IOException {
+      return reader.getTermFreqVector(docNumber, field);
     }
 
-    public boolean hasNorms(String field) throws IOException {
-      return reader.hasNorms(field);
+    public void getTermFreqVector(int docNumber, String field, TermVectorMapper mapper) throws IOException {
+      reader.getTermFreqVector(docNumber, field, mapper);
     }
 
-    public void deleteDocument(int docNum) throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException {
-      reader.deleteDocument(docNum);
+    public void getTermFreqVector(int docNumber, TermVectorMapper mapper) throws IOException {
+      reader.getTermFreqVector(docNumber, mapper);
     }
 
-    public int deleteDocuments(Term term) throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException {
-      return reader.deleteDocuments(term);
+    public int numDocs() {
+      return reader.numDocs();
     }
 
-    public int getRefCount() {
-      return reader.getRefCount();
+    public int maxDoc() {
+      return reader.maxDoc();
     }
 
-    public long getVersion() {
-      return reader.getVersion();
+    public Document document(int n, FieldSelector fieldSelector) throws CorruptIndexException, IOException {
+      return reader.document(n, fieldSelector);
+    }
+
+    public boolean hasDeletions() {
+      return reader.hasDeletions();
+    }
+
+    public boolean hasNorms(String field) throws IOException {
+      return reader.hasNorms(field);
+    }
+
+    public int docFreq(Term t) throws IOException {
+      return reader.docFreq(t);
+    }
+
+    public boolean equals(Object arg0) {
+      return reader.equals(arg0);
     }
 
     public Map<String, String> getCommitUserData() {
       return reader.getCommitUserData();
     }
 
-    public IndexCommit getIndexCommit() throws IOException {
-      return reader.getIndexCommit();
+    public FieldInfos getFieldInfos() {
+      return reader.getFieldInfos();
     }
 
-    public IndexReader[] getSequentialSubReaders() {
-      return wrap(reader.getSequentialSubReaders(), running);
+    public IndexCommit getIndexCommit() throws IOException {
+      return reader.getIndexCommit();
     }
 
     public Object getCoreCacheKey() {
@@ -175,76 +184,52 @@ public class EscapeRewrite {
       return reader.getTermInfosIndexDivisor();
     }
 
-    public void incRef() {
-      reader.incRef();
+    public int hashCode() {
+      return reader.hashCode();
     }
 
     public boolean isCurrent() throws CorruptIndexException, IOException {
       return reader.isCurrent();
     }
 
-    public void setNorm(int doc, String field, byte value) throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException {
-      reader.setNorm(doc, field, value);
-    }
-
-    public void setNorm(int doc, String field, float value) throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException {
-      reader.setNorm(doc, field, value);
-    }
-
-    public TermDocs termDocs(Term term) throws IOException {
-      return reader.termDocs(term);
-    }
-
-    public TermPositions termPositions(Term term) throws IOException {
-      return reader.termPositions(term);
-    }
-
-    public void undeleteAll() throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException {
-      reader.undeleteAll();
-    }
-
-    public TermFreqVector[] getTermFreqVectors(int docNumber) throws IOException {
-      return reader.getTermFreqVectors(docNumber);
-    }
-
-    public TermFreqVector getTermFreqVector(int docNumber, String field) throws IOException {
-      return reader.getTermFreqVector(docNumber, field);
-    }
-
-    public void getTermFreqVector(int docNumber, String field, TermVectorMapper mapper) throws IOException {
-      reader.getTermFreqVector(docNumber, field, mapper);
+    public boolean isDeleted(int n) {
+      return reader.isDeleted(n);
     }
 
-    public void getTermFreqVector(int docNumber, TermVectorMapper mapper) throws IOException {
-      reader.getTermFreqVector(docNumber, mapper);
+    public byte[] norms(String field) throws IOException {
+      return reader.norms(field);
     }
 
-    public int numDocs() {
-      return reader.numDocs();
+    public void norms(String field, byte[] bytes, int offset) throws IOException {
+      reader.norms(field, bytes, offset);
     }
 
-    public int maxDoc() {
-      return reader.maxDoc();
+    public TermDocs termDocs(Term term) throws IOException {
+      return reader.termDocs(term);
     }
 
-    public Document document(int n, FieldSelector fieldSelector) throws CorruptIndexException, IOException {
-      return reader.document(n, fieldSelector);
+    public TermDocs termDocs() throws IOException {
+      return reader.termDocs();
     }
 
-    public boolean isDeleted(int n) {
-      return reader.isDeleted(n);
+    public TermPositions termPositions() throws IOException {
+      return reader.termPositions();
     }
 
-    public boolean hasDeletions() {
-      return reader.hasDeletions();
+    public Object clone() {
+      IndexReaderRewriteEscape clone = (IndexReaderRewriteEscape) super.clone();
+      clone.reader = (IndexReader) reader.clone();
+      return clone;
     }
 
-    public byte[] norms(String field) throws IOException {
-      return reader.norms(field);
+    public IndexReader clone(boolean openReadOnly) throws CorruptIndexException, IOException {
+      IndexReaderRewriteEscape clone = (IndexReaderRewriteEscape) super.clone();
+      clone.reader = reader.clone(openReadOnly);
+      return clone;
     }
 
-    public void norms(String field, byte[] bytes, int offset) throws IOException {
-      reader.norms(field, bytes, offset);
+    public IndexReader[] getSequentialSubReaders() {
+      return wrap(reader.getSequentialSubReaders(), running);
     }
 
     public TermEnum terms() throws IOException {
@@ -255,56 +240,30 @@ public class EscapeRewrite {
       return wrap(reader.terms(t), running);
     }
 
-    public int docFreq(Term t) throws IOException {
-      return reader.docFreq(t);
-    }
-
-    public TermDocs termDocs() throws IOException {
-      return reader.termDocs();
-    }
-
-    public TermPositions termPositions() throws IOException {
-      return reader.termPositions();
-    }
-
-    public Collection<String> getFieldNames(FieldOption fldOption) {
-      return reader.getFieldNames(fldOption);
-    }
-
     @Override
     protected void doSetNorm(int doc, String field, byte value) throws CorruptIndexException, IOException {
-
+      reader.setNorm(doc, field, value);
     }
 
     @Override
     protected void doDelete(int docNum) throws CorruptIndexException, IOException {
-
+      reader.deleteDocument(docNum);
     }
 
     @Override
     protected void doUndeleteAll() throws CorruptIndexException, IOException {
-
+      reader.undeleteAll();
     }
 
     @Override
     protected void doCommit(Map<String, String> commitUserData) throws IOException {
-
+      reader.commit(commitUserData);
     }
 
     @Override
     protected void doClose() throws IOException {
       reader.close();
     }
-
-    @Override
-    public boolean equals(Object obj) {
-      return reader.equals(obj);
-    }
-
-    @Override
-    public int hashCode() {
-      return reader.hashCode();
-    }
   }
 
   public static TermEnum wrap(final TermEnum terms, final AtomicBoolean running) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dc9c1ac1/src/blur-store/src/main/java/org/apache/lucene/index/WarmUpByFieldBounds.java
----------------------------------------------------------------------
diff --git a/src/blur-store/src/main/java/org/apache/lucene/index/WarmUpByFieldBounds.java b/src/blur-store/src/main/java/org/apache/lucene/index/WarmUpByFieldBounds.java
index c167db7..64e1b52 100644
--- a/src/blur-store/src/main/java/org/apache/lucene/index/WarmUpByFieldBounds.java
+++ b/src/blur-store/src/main/java/org/apache/lucene/index/WarmUpByFieldBounds.java
@@ -4,6 +4,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -13,7 +14,6 @@ import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Field.Index;
 import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.index.IndexReader.FieldOption;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.store.LockObtainFailedException;
@@ -75,7 +75,13 @@ public class WarmUpByFieldBounds {
   private static final Log LOG = LogFactory.getLog(WarmUpByFieldBounds.class);
 
   public void warmUpByField(AtomicBoolean isClosed, Term term, IndexReader reader, WarmUpByFieldBoundsStatus status) throws IOException {
-    Collection<String> fieldNames = reader.getFieldNames(FieldOption.INDEXED);
+    FieldInfos fieldInfos = reader.getFieldInfos();
+    Collection<String> fieldNames = new HashSet<String>();
+    for (FieldInfo info : fieldInfos) {
+      if (info.isIndexed) {
+        fieldNames.add(info.name);
+      }
+    }
     List<String> fields = new ArrayList<String>(fieldNames);
     Collections.sort(fields);
     int index = fields.indexOf(term.field);


Mime
View raw message