LUCENE-3728: remove unnecessary code from SCR

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3661@1237768 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-01-30 16:38:50 +00:00
parent 846338c0dc
commit cdc68d0921
2 changed files with 6 additions and 14 deletions

View File

@ -48,16 +48,13 @@ final class SegmentCoreReaders {
// SegmentReaders: // SegmentReaders:
private final AtomicInteger ref = new AtomicInteger(1); private final AtomicInteger ref = new AtomicInteger(1);
final String segment;
final FieldInfos fieldInfos; final FieldInfos fieldInfos;
final FieldsProducer fields; final FieldsProducer fields;
final PerDocProducer perDocProducer; final PerDocProducer perDocProducer;
final PerDocProducer norms; final PerDocProducer norms;
final Directory dir; private final Directory cfsDir;
final Directory cfsDir;
final IOContext context;
final int termsIndexDivisor; final int termsIndexDivisor;
private final SegmentReader owner; private final SegmentReader owner;
@ -90,22 +87,17 @@ final class SegmentCoreReaders {
throw new IllegalArgumentException("indexDivisor must be < 0 (don't load terms index) or greater than 0 (got 0)"); throw new IllegalArgumentException("indexDivisor must be < 0 (don't load terms index) or greater than 0 (got 0)");
} }
segment = si.name;
final Codec codec = si.getCodec(); final Codec codec = si.getCodec();
this.context = context;
this.dir = dir;
boolean success = false; boolean success = false;
try { try {
Directory dir0 = dir;
if (si.getUseCompoundFile()) { if (si.getUseCompoundFile()) {
cfsReader = new CompoundFileDirectory(dir, IndexFileNames.segmentFileName(segment, "", IndexFileNames.COMPOUND_FILE_EXTENSION), context, false); cfsDir = cfsReader = new CompoundFileDirectory(dir, IndexFileNames.segmentFileName(si.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION), context, false);
dir0 = cfsReader;
} else { } else {
cfsReader = null; cfsReader = null;
cfsDir = dir;
} }
cfsDir = dir0;
si.loadFieldInfos(cfsDir, false); // prevent opening the CFS to load fieldInfos si.loadFieldInfos(cfsDir, false); // prevent opening the CFS to load fieldInfos
fieldInfos = si.getFieldInfos(); fieldInfos = si.getFieldInfos();

View File

@ -183,7 +183,7 @@ public final class SegmentReader extends IndexReader {
public String toString() { public String toString() {
// SegmentInfo.toString takes dir and number of // SegmentInfo.toString takes dir and number of
// *pending* deletions; so we reverse compute that here: // *pending* deletions; so we reverse compute that here:
return si.toString(core.dir, si.docCount - numDocs - si.getDelCount()); return si.toString(si.dir, si.docCount - numDocs - si.getDelCount());
} }
@Override @Override
@ -196,7 +196,7 @@ public final class SegmentReader extends IndexReader {
* Return the name of the segment this reader is reading. * Return the name of the segment this reader is reading.
*/ */
public String getSegmentName() { public String getSegmentName() {
return core.segment; return si.name;
} }
/** /**
@ -212,7 +212,7 @@ public final class SegmentReader extends IndexReader {
// Don't ensureOpen here -- in certain cases, when a // Don't ensureOpen here -- in certain cases, when a
// cloned/reopened reader needs to commit, it may call // cloned/reopened reader needs to commit, it may call
// this method on the closed original reader // this method on the closed original reader
return core.dir; return si.dir;
} }
// This is necessary so that cloned SegmentReaders (which // This is necessary so that cloned SegmentReaders (which