Index: lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (revision 1432292) +++ lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (working copy) @@ -100,7 +100,7 @@ createIndex("index.nocfs", false, false); } */ - + /* // These are only needed for the special upgrade test to verify // that also single-segment indexes are correctly upgraded by IndexUpgrader. @@ -116,8 +116,40 @@ } */ + + /* + public void testCreateMoreTermsIndex() throws Exception { + // we use a real directory name that is not cleaned up, + // because this method is only used to create backwards + // indexes: + File indexDir = new File("moreterms"); + _TestUtil.rmDir(indexDir); + Directory dir = newFSDirectory(indexDir); + + LogByteSizeMergePolicy mp = new LogByteSizeMergePolicy(); + mp.setUseCompoundFile(false); + mp.setNoCFSRatio(1.0); + mp.setMaxCFSSegmentSizeMB(Double.POSITIVE_INFINITY); + // TODO: remove randomness + IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())) + .setMergePolicy(mp); + conf.setCodec(Codec.forName("Lucene40")); + IndexWriter writer = new IndexWriter(dir, conf); + LineFileDocs docs = new LineFileDocs(null, true); + for(int i=0;i<50;i++) { + writer.addDocument(docs.nextDoc()); + } + writer.close(); + dir.close(); + + // Gives you time to copy the index out!: (there is also + // a test option to not remove temp dir...): + Thread.sleep(100000); + } + */ + final static String[] oldNames = {"40.cfs", - "40.nocfs", + "40.nocfs", }; final String[] unsupportedNames = {"19.cfs", @@ -145,7 +177,7 @@ }; final static String[] oldSingleSegmentNames = {"40.optimized.cfs", - "40.optimized.nocfs", + "40.optimized.nocfs", }; static Map oldIndexDirs; @@ -908,4 +940,15 @@ dir.close(); } } + + public static final String moreTermsIndex = "moreterms.40.zip"; + + public void testMoreTerms() throws Exception { + File oldIndexDir = _TestUtil.getTempDir("moreterms"); + _TestUtil.unzip(getDataFile(moreTermsIndex), oldIndexDir); + Directory dir = newFSDirectory(oldIndexDir); + // TODO: more tests + _TestUtil.checkIndex(dir); + dir.close(); + } } Index: lucene/core/src/test/org/apache/lucene/index/moreterms.40.zip =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: lucene/core/src/test/org/apache/lucene/index/moreterms.40.zip =================================================================== --- lucene/core/src/test/org/apache/lucene/index/moreterms.40.zip (revision 1432292) +++ lucene/core/src/test/org/apache/lucene/index/moreterms.40.zip (working copy) Property changes on: lucene/core/src/test/org/apache/lucene/index/moreterms.40.zip ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: lucene/core/src/java/org/apache/lucene/util/fst/FST.java =================================================================== --- lucene/core/src/java/org/apache/lucene/util/fst/FST.java (revision 1432292) +++ lucene/core/src/java/org/apache/lucene/util/fst/FST.java (working copy) @@ -27,6 +27,11 @@ import java.io.OutputStream; import java.util.HashMap; import java.util.Map; +/* +import java.io.Writer; +import java.io.OutputStreamWriter; +import java.io.FileOutputStream; +*/ import org.apache.lucene.codecs.CodecUtil; import org.apache.lucene.store.DataInput; @@ -345,6 +350,15 @@ // building; we need to break out mutable FST from // immutable allowArrayArcs = false; + + /* + if (bytes.length == 665) { + Writer w = new OutputStreamWriter(new FileOutputStream("out.dot"), "UTF-8"); + Util.toDot(this, w, false, false); + w.close(); + System.out.println("Wrote FST to out.dot"); + } + */ } public INPUT_TYPE getInputType() { @@ -656,7 +670,7 @@ if (targetHasArcs && (flags & BIT_TARGET_NEXT) == 0) { assert target.node > 0; //System.out.println(" write target"); - writer.writeInt(target.node); + writer.writeVInt(target.node); } // just write the arcs "like normal" on first pass, @@ -805,11 +819,9 @@ if (arc.flag(BIT_STOP_NODE)) { } else if (arc.flag(BIT_TARGET_NEXT)) { } else { - if (packed) { - in.readVInt(); - } else { - in.skip(4); - } + // nocommit this is a BW break? how come we + // don't see fails from TestBackCompat!? + in.readVInt(); } arc.flags = in.readByte(); } @@ -921,8 +933,10 @@ int pos = in.pos = getNodeAddress(arc.nextArc); final byte b = in.readByte(); if (b == ARCS_AS_FIXED_ARRAY) { - //System.out.println(" nextArc fake array"); + //System.out.println(" nextArc fixed array"); in.readVInt(); + + // Skip bytesPerArc: if (packed) { in.readVInt(); } else { @@ -1024,7 +1038,7 @@ //System.out.println(" abs code=" + code + " derefLen=" + nodeRefToAddress.length); } } else { - arc.target = in.readInt(); + arc.target = in.readVInt(); } arc.nextArc = in.pos; } @@ -1144,11 +1158,7 @@ } if (!flag(flags, BIT_STOP_NODE) && !flag(flags, BIT_TARGET_NEXT)) { - if (packed) { - in.readVInt(); - } else { - in.readInt(); - } + in.readVInt(); } if (flag(flags, BIT_LAST_ARC)) { Index: lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java =================================================================== --- lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java (revision 1432292) +++ lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java (working copy) @@ -289,6 +289,13 @@ null, willRewrite, true); + if (LuceneTestCase.VERBOSE) { + if (willRewrite) { + System.out.println("TEST: packed FST"); + } else { + System.out.println("TEST: non-packed FST"); + } + } for(InputOutput pair : pairs) { if (pair.output instanceof List) {