LUCENE-5141: CheckIndex.fixIndex doesn't need a Codec.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1507808 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrien Grand 2013-07-28 16:10:16 +00:00
parent 2902c40cfd
commit 503b2b29a6
2 changed files with 9 additions and 12 deletions

View File

@ -115,6 +115,12 @@ Documentation
* LUCENE-4894: remove facet userguide as it was outdated. Partially absorbed into * LUCENE-4894: remove facet userguide as it was outdated. Partially absorbed into
package's documentation and classes javadocs. (Shai Erera) package's documentation and classes javadocs. (Shai Erera)
Changes in backwards compatibility policy
* LUCENE-5141: CheckIndex.fixIndex(Status,Codec) is now
CheckIndex.fixIndex(Status). If you used to pass a codec to this method, just
remove it from the arguments. (Adrien Grand)
======================= Lucene 4.4.0 ======================= ======================= Lucene 4.4.0 =======================
Changes in backwards compatibility policy Changes in backwards compatibility policy

View File

@ -30,8 +30,7 @@ import java.util.Map;
import org.apache.lucene.codecs.BlockTreeTermsReader; import org.apache.lucene.codecs.BlockTreeTermsReader;
import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.PostingsFormat; // javadocs import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.document.FieldType; // for javadocs
import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus; import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus;
import org.apache.lucene.index.FieldInfo.IndexOptions; import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.DocIdSetIterator;
@ -1684,7 +1683,7 @@ public class CheckIndex {
* *
* <p><b>WARNING</b>: Make sure you only call this when the * <p><b>WARNING</b>: Make sure you only call this when the
* index is not opened by any writer. */ * index is not opened by any writer. */
public void fixIndex(Status result, Codec codec) throws IOException { public void fixIndex(Status result) throws IOException {
if (result.partial) if (result.partial)
throw new IllegalArgumentException("can only fix an index that was fully checked (this status checked a subset of segments)"); throw new IllegalArgumentException("can only fix an index that was fully checked (this status checked a subset of segments)");
result.newSegments.changed(); result.newSegments.changed();
@ -1739,7 +1738,6 @@ public class CheckIndex {
boolean doFix = false; boolean doFix = false;
boolean doCrossCheckTermVectors = false; boolean doCrossCheckTermVectors = false;
Codec codec = Codec.getDefault(); // only used when fixing
boolean verbose = false; boolean verbose = false;
List<String> onlySegments = new ArrayList<String>(); List<String> onlySegments = new ArrayList<String>();
String indexPath = null; String indexPath = null;
@ -1751,13 +1749,6 @@ public class CheckIndex {
doFix = true; doFix = true;
} else if ("-crossCheckTermVectors".equals(arg)) { } else if ("-crossCheckTermVectors".equals(arg)) {
doCrossCheckTermVectors = true; doCrossCheckTermVectors = true;
} else if ("-codec".equals(arg)) {
if (i == args.length-1) {
System.out.println("ERROR: missing name for -codec option");
System.exit(1);
}
i++;
codec = Codec.forName(args[i]);
} else if (arg.equals("-verbose")) { } else if (arg.equals("-verbose")) {
verbose = true; verbose = true;
} else if (arg.equals("-segment")) { } else if (arg.equals("-segment")) {
@ -1858,7 +1849,7 @@ public class CheckIndex {
System.out.println(" " + (5-s) + "..."); System.out.println(" " + (5-s) + "...");
} }
System.out.println("Writing..."); System.out.println("Writing...");
checker.fixIndex(result, codec); checker.fixIndex(result);
System.out.println("OK"); System.out.println("OK");
System.out.println("Wrote new segments file \"" + result.newSegments.getSegmentsFileName() + "\""); System.out.println("Wrote new segments file \"" + result.newSegments.getSegmentsFileName() + "\"");
} }