LUCENE-3728: really make separate norms totally private to 3.x codec

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3661@1237272 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-01-29 13:02:32 +00:00
parent a5c5bbbffe
commit 5d96aa30c1
5 changed files with 14 additions and 16 deletions

View File

@ -66,9 +66,9 @@ public abstract class Codec implements NamedSPILoader.NamedSPI {
/** Populates <code>files</code> with any filenames that are
* stored outside of CFS for the <code>info</code> segment.
*/
// TODO: can we somehow totally remove this?
public void separateFiles(Directory dir, SegmentInfo info, Set<String> files) throws IOException {
liveDocsFormat().separateFiles(dir, info, files);
normsFormat().separateFiles(dir, info, files);
}
/** Encodes/decodes postings */

View File

@ -32,11 +32,4 @@ public abstract class NormsFormat {
public abstract PerDocConsumer docsConsumer(PerDocWriteState state) throws IOException;
public abstract PerDocProducer docsProducer(SegmentReadState state) throws IOException;
public abstract void files(Directory dir, SegmentInfo info, Set<String> files) throws IOException;
/**
* Note: this should not be overridden!
* @deprecated
*/
@Deprecated
public void separateFiles(Directory dir, SegmentInfo info, Set<String> files) throws IOException {};
}

View File

@ -24,7 +24,6 @@ import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.codecs.FieldInfosFormat;
import org.apache.lucene.codecs.LiveDocsFormat;
import org.apache.lucene.codecs.NormsFormat;
import org.apache.lucene.codecs.PerDocConsumer;
import org.apache.lucene.codecs.PerDocProducer;
import org.apache.lucene.codecs.PostingsFormat;
@ -41,7 +40,6 @@ import org.apache.lucene.index.SegmentReadState;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.util.MutableBits;
import org.apache.lucene.util.StringHelper;
/**
* Supports the Lucene 3.x index format (readonly)
@ -67,7 +65,7 @@ public class Lucene3xCodec extends Codec {
private final SegmentInfosFormat infosFormat = new Lucene3xSegmentInfosFormat();
private final NormsFormat normsFormat = new Lucene3xNormsFormat();
private final Lucene3xNormsFormat normsFormat = new Lucene3xNormsFormat();
// TODO: this should really be a different impl
private final LiveDocsFormat liveDocsFormat = new Lucene40LiveDocsFormat() {
@ -124,7 +122,7 @@ public class Lucene3xCodec extends Codec {
}
@Override
public NormsFormat normsFormat() {
public Lucene3xNormsFormat normsFormat() {
return normsFormat;
}
@ -144,4 +142,12 @@ public class Lucene3xCodec extends Codec {
super.files(dir, info, files);
}
}
// override the default implementation in codec.java to handle separate norms files
@Override
public void separateFiles(Directory dir, SegmentInfo info, Set<String> files) throws IOException {
super.separateFiles(dir, info, files);
normsFormat().separateFiles(dir, info, files);
}
}

View File

@ -43,7 +43,6 @@ public class Lucene3xNormsFormat extends NormsFormat {
Lucene3xNormsProducer.files(dir, info, files);
}
@Override
public void separateFiles(Directory dir, SegmentInfo info, Set<String> files) throws IOException {
Lucene3xNormsProducer.separateFiles(dir, info, files);
}

View File

@ -22,12 +22,12 @@ import java.util.Set;
import org.apache.lucene.codecs.FieldInfosFormat;
import org.apache.lucene.codecs.LiveDocsFormat;
import org.apache.lucene.codecs.NormsFormat;
import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.codecs.SegmentInfosFormat;
import org.apache.lucene.codecs.StoredFieldsFormat;
import org.apache.lucene.codecs.TermVectorsFormat;
import org.apache.lucene.codecs.lucene3x.Lucene3xCodec;
import org.apache.lucene.codecs.lucene3x.Lucene3xNormsFormat;
import org.apache.lucene.codecs.lucene40.Lucene40LiveDocsFormat;
import org.apache.lucene.codecs.lucene40.Lucene40StoredFieldsFormat;
import org.apache.lucene.index.IndexFileNames;
@ -42,7 +42,7 @@ import org.apache.lucene.util.StringHelper;
*/
public class PreFlexRWCodec extends Lucene3xCodec {
private final PostingsFormat postings = new PreFlexRWPostingsFormat();
private final NormsFormat norms = new PreFlexRWNormsFormat();
private final Lucene3xNormsFormat norms = new PreFlexRWNormsFormat();
private final FieldInfosFormat fieldInfos = new PreFlexRWFieldInfosFormat();
private final TermVectorsFormat termVectors = new PreFlexRWTermVectorsFormat();
private final SegmentInfosFormat segmentInfos = new PreFlexRWSegmentInfosFormat();
@ -61,7 +61,7 @@ public class PreFlexRWCodec extends Lucene3xCodec {
}
@Override
public NormsFormat normsFormat() {
public Lucene3xNormsFormat normsFormat() {
if (LuceneTestCase.PREFLEX_IMPERSONATION_IS_ACTIVE) {
return norms;
} else {