lucene 4: changed InternalIndexShard#checkIndex to use the new fixIndex and indexExists apis
This commit is contained in:
parent
8009b80481
commit
c3633ab99f
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue