diff --git a/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java b/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java index 6c92f4c9ac8..3464798bf13 100644 --- a/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java +++ b/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java @@ -21,7 +21,7 @@ package org.elasticsearch.index.shard.service; import com.google.common.base.Charsets; import org.apache.lucene.index.CheckIndex; -import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.search.Filter; import org.apache.lucene.search.FilteredQuery; import org.apache.lucene.search.Query; @@ -808,11 +808,13 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I } } + //LUCENE 4 UPGRADE: currently passing 'null' codec to fixIndex, when we have proper support for a codec service + // we'll us that to figure out the codec that should be used private void checkIndex(boolean throwException) throws IndexShardException { try { checkIndexTook = 0; long time = System.currentTimeMillis(); - if (!IndexReader.indexExists(store.directory())) { + if (!DirectoryReader.indexExists(store.directory())) { return; } CheckIndex checkIndex = new CheckIndex(store.directory()); @@ -831,7 +833,7 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I if (logger.isDebugEnabled()) { logger.debug("fixing index, writing new segments file ..."); } - checkIndex.fixIndex(status); + checkIndex.fixIndex(status, null); if (logger.isDebugEnabled()) { logger.debug("index fixed, wrote new segments file \"{}\"", status.segmentsFileName); }