Skip to content

Apache Lucene open-source search software

add support for compound index format when creating new index

Erik Hatcher48fa83e2ac2d
diff --git a/sandbox/contributions/ant/src/main/org/apache/lucene/ant/IndexTask.java b/sandbox/contributions/ant/src/main/org/apache/lucene/ant/IndexTask.java
index fde7e8635ea..d1d5f4d5329 100644
--- a/sandbox/contributions/ant/src/main/org/apache/lucene/ant/IndexTask.java
+++ b/sandbox/contributions/ant/src/main/org/apache/lucene/ant/IndexTask.java
@@ -84,6 +84,8 @@ public class IndexTask extends Task {
private HandlerConfig handlerConfig;
+ private boolean useCompoundIndex = true;
+
/**
* Creates new instance
@@ -120,6 +122,14 @@ public class IndexTask extends Task {
}
+ /**
+ * If creating a new index and this is set to true, the
+ * index will be created in compound format.
+ */
+ public void setUseCompoundIndex(boolean useCompoundIndex) {
+ this.useCompoundIndex = useCompoundIndex;
+ }
+
/**
* Sets the documentHandler attribute of the IndexTask object
*
@@ -234,6 +244,10 @@ public class IndexTask extends Task {
IndexWriter writer =
new IndexWriter(indexDir, analyzer, create);
+
+ if (create && useCompoundIndex) {
+ writer.setUseCompoundFile(useCompoundIndex);
+ }
int totalFiles = 0;
int totalIndexed = 0;
int totalIgnored = 0;