From 022d7d2fe441166ce60007d6230565bb39cb38d8 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Mon, 2 Aug 2010 22:10:41 +0000 Subject: [PATCH] remove dead code, take 2 git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@981696 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/index/FieldsReader.java | 6 ------ .../org/apache/lucene/index/SegmentMerger.java | 2 +- .../apache/lucene/index/TermVectorsReader.java | 15 ++++++++------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lucene/src/java/org/apache/lucene/index/FieldsReader.java b/lucene/src/java/org/apache/lucene/index/FieldsReader.java index ee5882464ed..96b58120e50 100644 --- a/lucene/src/java/org/apache/lucene/index/FieldsReader.java +++ b/lucene/src/java/org/apache/lucene/index/FieldsReader.java @@ -186,12 +186,6 @@ final class FieldsReader implements Cloneable { indexStream.seek(FORMAT_SIZE + (docID + docStoreOffset) * 8L); } - boolean canReadRawDocs() { - // Since we currently only support >3.0 format anymore, always return true! - // I leave this method in because it may help for later format changes. - return true; - } - final Document doc(int n, FieldSelector fieldSelector) throws CorruptIndexException, IOException { seekIndex(n); long position = indexStream.readLong(); diff --git a/lucene/src/java/org/apache/lucene/index/SegmentMerger.java b/lucene/src/java/org/apache/lucene/index/SegmentMerger.java index 03426549f0e..315708d7b0d 100644 --- a/lucene/src/java/org/apache/lucene/index/SegmentMerger.java +++ b/lucene/src/java/org/apache/lucene/index/SegmentMerger.java @@ -321,7 +321,7 @@ final class SegmentMerger { FieldsReader matchingFieldsReader = null; if (matchingSegmentReader != null) { final FieldsReader fieldsReader = matchingSegmentReader.getFieldsReader(); - if (fieldsReader != null && fieldsReader.canReadRawDocs()) { + if (fieldsReader != null) { matchingFieldsReader = fieldsReader; } } diff --git a/lucene/src/java/org/apache/lucene/index/TermVectorsReader.java b/lucene/src/java/org/apache/lucene/index/TermVectorsReader.java index 63201238e53..bc98c488f74 100644 --- a/lucene/src/java/org/apache/lucene/index/TermVectorsReader.java +++ b/lucene/src/java/org/apache/lucene/index/TermVectorsReader.java @@ -104,8 +104,12 @@ class TermVectorsReader implements Cloneable { // docs assert numTotalDocs >= size + docStoreOffset: "numTotalDocs=" + numTotalDocs + " size=" + size + " docStoreOffset=" + docStoreOffset; } - } else + } else { + // TODO: understand why FieldInfos.hasVectors() can + // return true yet the term vectors files don't + // exist... format = 0; + } this.fieldInfos = fieldInfos; success = true; @@ -136,7 +140,9 @@ class TermVectorsReader implements Cloneable { } boolean canReadRawDocs() { - return format >= FORMAT_UTF8_LENGTH_IN_BYTES; + // we can always read raw docs, unless the term vectors + // didn't exist + return format != 0; } /** Retrieve the length (in bytes) of the tvd and tvf @@ -153,11 +159,6 @@ class TermVectorsReader implements Cloneable { return; } - // SegmentMerger calls canReadRawDocs() first and should - // not call us if that returns false. - if (format < FORMAT_UTF8_LENGTH_IN_BYTES) - throw new IllegalStateException("cannot read raw docs with older term vector formats"); - seekTvx(startDocID); long tvdPosition = tvx.readLong();