From cdc68d0921d859dbcf5c5125c36d978a933ac742 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Mon, 30 Jan 2012 16:38:50 +0000 Subject: [PATCH] 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 --- .../apache/lucene/index/SegmentCoreReaders.java | 14 +++----------- .../org/apache/lucene/index/SegmentReader.java | 6 +++--- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/lucene/src/java/org/apache/lucene/index/SegmentCoreReaders.java b/lucene/src/java/org/apache/lucene/index/SegmentCoreReaders.java index 657981e2b42..8e6815777fa 100644 --- a/lucene/src/java/org/apache/lucene/index/SegmentCoreReaders.java +++ b/lucene/src/java/org/apache/lucene/index/SegmentCoreReaders.java @@ -48,16 +48,13 @@ final class SegmentCoreReaders { // SegmentReaders: private final AtomicInteger ref = new AtomicInteger(1); - final String segment; final FieldInfos fieldInfos; final FieldsProducer fields; final PerDocProducer perDocProducer; final PerDocProducer norms; - final Directory dir; - final Directory cfsDir; - final IOContext context; + private final Directory cfsDir; final int termsIndexDivisor; 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)"); } - segment = si.name; final Codec codec = si.getCodec(); - this.context = context; - this.dir = dir; boolean success = false; try { - Directory dir0 = dir; if (si.getUseCompoundFile()) { - cfsReader = new CompoundFileDirectory(dir, IndexFileNames.segmentFileName(segment, "", IndexFileNames.COMPOUND_FILE_EXTENSION), context, false); - dir0 = cfsReader; + cfsDir = cfsReader = new CompoundFileDirectory(dir, IndexFileNames.segmentFileName(si.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION), context, false); } else { cfsReader = null; + cfsDir = dir; } - cfsDir = dir0; si.loadFieldInfos(cfsDir, false); // prevent opening the CFS to load fieldInfos fieldInfos = si.getFieldInfos(); diff --git a/lucene/src/java/org/apache/lucene/index/SegmentReader.java b/lucene/src/java/org/apache/lucene/index/SegmentReader.java index 02ad8451076..e97447c524d 100644 --- a/lucene/src/java/org/apache/lucene/index/SegmentReader.java +++ b/lucene/src/java/org/apache/lucene/index/SegmentReader.java @@ -183,7 +183,7 @@ public final class SegmentReader extends IndexReader { public String toString() { // SegmentInfo.toString takes dir and number of // *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 @@ -196,7 +196,7 @@ public final class SegmentReader extends IndexReader { * Return the name of the segment this reader is reading. */ 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 // cloned/reopened reader needs to commit, it may call // this method on the closed original reader - return core.dir; + return si.dir; } // This is necessary so that cloned SegmentReaders (which