Skip to content

Apache Lucene open-source search software

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

Adrien Grand503b2b29a678
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 75cf09ff8c8..7c52f2d7c34 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -115,6 +115,12 @@ Documentation
* LUCENE-4894: remove facet userguide as it was outdated. Partially absorbed into
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 =======================
Changes in backwards compatibility policy
diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
index 64c9d171fda..727e094c383 100644
--- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
+++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
@@ -30,8 +30,7 @@ import java.util.Map;
import org.apache.lucene.codecs.BlockTreeTermsReader;
import org.apache.lucene.codecs.Codec;
-import org.apache.lucene.codecs.PostingsFormat; // javadocs
-import org.apache.lucene.document.FieldType; // for javadocs
+import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus;
import org.apache.lucene.index.FieldInfo.IndexOptions;
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
* 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)
throw new IllegalArgumentException("can only fix an index that was fully checked (this status checked a subset of segments)");
result.newSegments.changed();
@@ -1739,7 +1738,6 @@ public class CheckIndex {
boolean doFix = false;
boolean doCrossCheckTermVectors = false;
- Codec codec = Codec.getDefault(); // only used when fixing
boolean verbose = false;
List<String> onlySegments = new ArrayList<String>();
String indexPath = null;
@@ -1751,13 +1749,6 @@ public class CheckIndex {
doFix = true;
} else if ("-crossCheckTermVectors".equals(arg)) {
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")) {
verbose = true;
} else if (arg.equals("-segment")) {
@@ -1858,7 +1849,7 @@ public class CheckIndex {
System.out.println(" " + (5-s) + "...");
}
System.out.println("Writing...");
- checker.fixIndex(result, codec);
+ checker.fixIndex(result);
System.out.println("OK");
System.out.println("Wrote new segments file \"" + result.newSegments.getSegmentsFileName() + "\"");
}