use constants to build file names in TermInfosWriter

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1136454 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2011-06-16 14:29:43 +00:00
parent f01acfa744
commit 240822d45a
1 changed files with 11 additions and 3 deletions

View File

@ -22,6 +22,8 @@ import java.io.Closeable;
import java.io.IOException;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.IndexFileNames;
import org.apache.lucene.index.codecs.preflex.PreFlexCodec;
import org.apache.lucene.index.codecs.preflex.TermInfo;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IndexOutput;
@ -102,7 +104,9 @@ final class TermInfosWriter implements Closeable {
}
try {
directory.deleteFile(segment + (isIndex ? ".tii" : ".tis"));
directory.deleteFile(IndexFileNames.segmentFileName(segment, "",
(isIndex ? PreFlexCodec.TERMS_INDEX_EXTENSION
: PreFlexCodec.TERMS_EXTENSION)));
} catch (IOException ignored) {
}
}
@ -119,7 +123,9 @@ final class TermInfosWriter implements Closeable {
indexInterval = interval;
fieldInfos = fis;
isIndex = isi;
output = directory.createOutput(segment + (isIndex ? ".tii" : ".tis"));
output = directory.createOutput(IndexFileNames.segmentFileName(segment, "",
(isIndex ? PreFlexCodec.TERMS_INDEX_EXTENSION
: PreFlexCodec.TERMS_EXTENSION)));
boolean success = false;
try {
output.writeInt(FORMAT_CURRENT); // write format
@ -139,7 +145,9 @@ final class TermInfosWriter implements Closeable {
}
try {
directory.deleteFile(segment + (isIndex ? ".tii" : ".tis"));
directory.deleteFile(IndexFileNames.segmentFileName(segment, "",
(isIndex ? PreFlexCodec.TERMS_INDEX_EXTENSION
: PreFlexCodec.TERMS_EXTENSION)));
} catch (IOException ignored) {
}
}