mirror of https://github.com/apache/lucene.git
LUCENE-4119 SegmentInfoFormat.getSegmentInfos{Reader,Writer} should be singular.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1347777 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
93d75d8e23
commit
211f9c77b7
|
@ -28,6 +28,6 @@ import org.apache.lucene.index.SegmentInfo;
|
|||
* @lucene.experimental
|
||||
*/
|
||||
public abstract class SegmentInfoFormat {
|
||||
public abstract SegmentInfoReader getSegmentInfosReader();
|
||||
public abstract SegmentInfoWriter getSegmentInfosWriter();
|
||||
public abstract SegmentInfoReader getSegmentInfoReader();
|
||||
public abstract SegmentInfoWriter getSegmentInfoWriter();
|
||||
}
|
||||
|
|
|
@ -72,12 +72,12 @@ public class Lucene40SegmentInfoFormat extends SegmentInfoFormat {
|
|||
private final SegmentInfoWriter writer = new Lucene40SegmentInfoWriter();
|
||||
|
||||
@Override
|
||||
public SegmentInfoReader getSegmentInfosReader() {
|
||||
public SegmentInfoReader getSegmentInfoReader() {
|
||||
return reader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SegmentInfoWriter getSegmentInfosWriter() {
|
||||
public SegmentInfoWriter getSegmentInfoWriter() {
|
||||
return writer;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,12 +34,12 @@ public class SimpleTextSegmentInfoFormat extends SegmentInfoFormat {
|
|||
public static final String SI_EXTENSION = "si";
|
||||
|
||||
@Override
|
||||
public SegmentInfoReader getSegmentInfosReader() {
|
||||
public SegmentInfoReader getSegmentInfoReader() {
|
||||
return reader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SegmentInfoWriter getSegmentInfosWriter() {
|
||||
public SegmentInfoWriter getSegmentInfoWriter() {
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2042,7 +2042,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
// creating CFS so that 1) .si isn't slurped into CFS,
|
||||
// and 2) .si reflects useCompoundFile=true change
|
||||
// above:
|
||||
codec.segmentInfoFormat().getSegmentInfosWriter().write(directory, newSegment.info, flushedSegment.fieldInfos, context);
|
||||
codec.segmentInfoFormat().getSegmentInfoWriter().write(directory, newSegment.info, flushedSegment.fieldInfos, context);
|
||||
|
||||
// TODO: ideally we would freeze newSegment here!!
|
||||
// because any changes after writing the .si will be
|
||||
|
@ -2334,7 +2334,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
// creating CFS so that 1) .si isn't slurped into CFS,
|
||||
// and 2) .si reflects useCompoundFile=true change
|
||||
// above:
|
||||
codec.segmentInfoFormat().getSegmentInfosWriter().write(trackingDir, info, mergeState.fieldInfos, context);
|
||||
codec.segmentInfoFormat().getSegmentInfoWriter().write(trackingDir, info, mergeState.fieldInfos, context);
|
||||
info.addFiles(trackingDir.getCreatedFiles());
|
||||
|
||||
// Register the new segment
|
||||
|
@ -2408,7 +2408,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
// store segment name):
|
||||
TrackingDirectoryWrapper trackingDir = new TrackingDirectoryWrapper(directory);
|
||||
try {
|
||||
newInfo.getCodec().segmentInfoFormat().getSegmentInfosWriter().write(trackingDir, newInfo, fis, context);
|
||||
newInfo.getCodec().segmentInfoFormat().getSegmentInfoWriter().write(trackingDir, newInfo, fis, context);
|
||||
} catch (UnsupportedOperationException uoe) {
|
||||
// OK: 3x codec cannot write a new SI file;
|
||||
// SegmentInfos will write this on commit
|
||||
|
@ -3567,7 +3567,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
// above:
|
||||
boolean success2 = false;
|
||||
try {
|
||||
codec.segmentInfoFormat().getSegmentInfosWriter().write(directory, merge.info.info, mergeState.fieldInfos, context);
|
||||
codec.segmentInfoFormat().getSegmentInfoWriter().write(directory, merge.info.info, mergeState.fieldInfos, context);
|
||||
success2 = true;
|
||||
} finally {
|
||||
if (!success2) {
|
||||
|
|
|
@ -286,7 +286,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfoPerCom
|
|||
String segName = input.readString();
|
||||
Codec codec = Codec.forName(input.readString());
|
||||
//System.out.println("SIS.read seg=" + seg + " codec=" + codec);
|
||||
SegmentInfo info = codec.segmentInfoFormat().getSegmentInfosReader().read(directory, segName, IOContext.READ);
|
||||
SegmentInfo info = codec.segmentInfoFormat().getSegmentInfoReader().read(directory, segName, IOContext.READ);
|
||||
info.setCodec(codec);
|
||||
long delGen = input.readLong();
|
||||
int delCount = input.readInt();
|
||||
|
|
Loading…
Reference in New Issue