mirror of https://github.com/apache/lucene.git
- Made String COMPOUND_EXTENSIONS[] static and moved the definition higher
in the code. - Cleaned up a bit. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150097 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
485e3c336f
commit
b84e20281e
|
@ -72,6 +72,11 @@ final class SegmentMerger {
|
||||||
private Vector readers = new Vector();
|
private Vector readers = new Vector();
|
||||||
private FieldInfos fieldInfos;
|
private FieldInfos fieldInfos;
|
||||||
|
|
||||||
|
// File extensions of old-style index files
|
||||||
|
private static final String COMPOUND_EXTENSIONS[] = new String[] {
|
||||||
|
"fnm", "frq", "prx", "fdx", "fdt", "tii", "tis"
|
||||||
|
};
|
||||||
|
|
||||||
SegmentMerger(Directory dir, String name, boolean compoundFile) {
|
SegmentMerger(Directory dir, String name, boolean compoundFile) {
|
||||||
directory = dir;
|
directory = dir;
|
||||||
segment = name;
|
segment = name;
|
||||||
|
@ -103,17 +108,9 @@ final class SegmentMerger {
|
||||||
createCompoundFile();
|
createCompoundFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add the fixed files
|
|
||||||
private final String COMPOUND_EXTENSIONS[] = new String[] {
|
|
||||||
"fnm", "frq", "prx", "fdx", "fdt", "tii", "tis"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
private final void createCompoundFile()
|
private final void createCompoundFile()
|
||||||
throws IOException
|
throws IOException {
|
||||||
{
|
CompoundFileWriter cfsWriter =
|
||||||
CompoundFileWriter oneWriter =
|
|
||||||
new CompoundFileWriter(directory, segment + ".cfs");
|
new CompoundFileWriter(directory, segment + ".cfs");
|
||||||
|
|
||||||
ArrayList files =
|
ArrayList files =
|
||||||
|
@ -135,17 +132,16 @@ final class SegmentMerger {
|
||||||
// Now merge all added files
|
// Now merge all added files
|
||||||
Iterator it = files.iterator();
|
Iterator it = files.iterator();
|
||||||
while(it.hasNext()) {
|
while(it.hasNext()) {
|
||||||
oneWriter.addFile((String) it.next());
|
cfsWriter.addFile((String) it.next());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform the merge
|
// Perform the merge
|
||||||
oneWriter.close();
|
cfsWriter.close();
|
||||||
|
|
||||||
|
|
||||||
// Now delete the source files
|
// Now delete the source files
|
||||||
it = files.iterator();
|
it = files.iterator();
|
||||||
while(it.hasNext()) {
|
while(it.hasNext()) {
|
||||||
directory.deleteFile((String) it.next());
|
directory.deleteFile((String) it.next());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue