From b84e20281e614bd6b00e4b0d5aaa0ff4c1efdfd6 Mon Sep 17 00:00:00 2001 From: Otis Gospodnetic Date: Mon, 13 Oct 2003 14:27:28 +0000 Subject: [PATCH] - 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 --- .../apache/lucene/index/SegmentMerger.java | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/java/org/apache/lucene/index/SegmentMerger.java b/src/java/org/apache/lucene/index/SegmentMerger.java index d7b5517633e..a507f5006b6 100644 --- a/src/java/org/apache/lucene/index/SegmentMerger.java +++ b/src/java/org/apache/lucene/index/SegmentMerger.java @@ -71,6 +71,11 @@ final class SegmentMerger { private Vector readers = new Vector(); 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) { directory = dir; @@ -103,17 +108,9 @@ final class SegmentMerger { createCompoundFile(); } - - // Add the fixed files - private final String COMPOUND_EXTENSIONS[] = new String[] { - "fnm", "frq", "prx", "fdx", "fdt", "tii", "tis" - }; - - private final void createCompoundFile() - throws IOException - { - CompoundFileWriter oneWriter = + throws IOException { + CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, segment + ".cfs"); ArrayList files = @@ -135,17 +132,16 @@ final class SegmentMerger { // Now merge all added files Iterator it = files.iterator(); while(it.hasNext()) { - oneWriter.addFile((String) it.next()); + cfsWriter.addFile((String) it.next()); } // Perform the merge - oneWriter.close(); - - + cfsWriter.close(); + // Now delete the source files it = files.iterator(); while(it.hasNext()) { - directory.deleteFile((String) it.next()); + directory.deleteFile((String) it.next()); } }