fix documentation, this works fine with compound file now

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1204271 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-11-20 21:49:18 +00:00
parent 4a7da8e14e
commit b649e35381
2 changed files with 17 additions and 6 deletions

View File

@ -33,12 +33,7 @@ import org.apache.lucene.index.codecs.lucene40.Lucene40Codec;
/**
* This codec extends {@link Lucene40Codec} to work on append-only outputs, such
* as plain output streams and append-only filesystems.
*
* <p>Note: compound file format feature is not compatible with
* this codec. You must call both
* LogMergePolicy.setUseCompoundFile(false) and
* LogMergePolicy.setUseCompoundDocStore(false) to disable
* compound file format.</p>
*
* @lucene.experimental
*/
public class AppendingCodec extends Codec {

View File

@ -146,4 +146,20 @@ public class TestAppendingCodec extends LuceneTestCase {
assertTrue(de.advance(2) == DocsEnum.NO_MORE_DOCS);
reader.close();
}
public void testCompoundFile() throws Exception {
Directory dir = new AppendingRAMDirectory(random, new RAMDirectory());
IndexWriterConfig cfg = new IndexWriterConfig(Version.LUCENE_40, new MockAnalyzer(random));
TieredMergePolicy mp = new TieredMergePolicy();
mp.setUseCompoundFile(true);
mp.setNoCFSRatio(1.0);
cfg.setMergePolicy(mp);
cfg.setCodec(new AppendingCodec());
IndexWriter writer = new IndexWriter(dir, cfg);
Document doc = new Document();
writer.addDocument(doc);
writer.close();
assertTrue(dir.fileExists("_0.cfs"));
dir.close();
}
}