You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2011/05/09 18:46:27 UTC
svn commit: r1101107 - in /lucene/dev/trunk: ./ lucene/ lucene/backwards/
lucene/src/test/org/apache/lucene/index/ solr/ solr/client/ solr/contrib/
solr/example/ solr/lib/ solr/site/ solr/src/
Author: uschindler
Date: Mon May 9 16:46:26 2011
New Revision: 1101107
URL: http://svn.apache.org/viewvc?rev=1101107&view=rev
Log:
Add code to build 3.1 compressed test indexes for upgrade test in 3.2+ and trunk; cleanup code
Modified:
lucene/dev/trunk/ (props changed)
lucene/dev/trunk/lucene/ (props changed)
lucene/dev/trunk/lucene/backwards/ (props changed)
lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
lucene/dev/trunk/solr/ (props changed)
lucene/dev/trunk/solr/CHANGES.txt (props changed)
lucene/dev/trunk/solr/LICENSE.txt (props changed)
lucene/dev/trunk/solr/NOTICE.txt (props changed)
lucene/dev/trunk/solr/README.txt (props changed)
lucene/dev/trunk/solr/build.xml (props changed)
lucene/dev/trunk/solr/client/ (props changed)
lucene/dev/trunk/solr/common-build.xml (props changed)
lucene/dev/trunk/solr/contrib/ (props changed)
lucene/dev/trunk/solr/example/ (props changed)
lucene/dev/trunk/solr/lib/ (props changed)
lucene/dev/trunk/solr/site/ (props changed)
lucene/dev/trunk/solr/src/ (props changed)
lucene/dev/trunk/solr/testlogging.properties (props changed)
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java?rev=1101107&r1=1101106&r2=1101107&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java Mon May 9 16:46:26 2011
@@ -66,26 +66,27 @@ public class TestBackwardsCompatibility
// oldNames array.
/*
- public void testCreatePreLocklessCFS() throws IOException {
- createIndex("index.cfs", true);
+ public void testCreateCFS() throws IOException {
+ createIndex("index.cfs", true, false);
}
- public void testCreatePreLocklessNoCFS() throws IOException {
- createIndex("index.nocfs", false);
+ public void testCreateNoCFS() throws IOException {
+ createIndex("index.nocfs", false, false);
}
*/
-
+
/*
- public void testCreateCFS() throws IOException {
- String dirName = "testindex.cfs";
- createIndex(dirName, true);
- rmDir(dirName);
+ // These are only needed for the special upgrade test to verify
+ // that also optimized indexes are correctly upgraded by IndexUpgrader.
+ // You don't need them to be build for non-3.1 (the test is happy with just one
+ // "old" segment format, version is unimportant:
+
+ public void testCreateOptimizedCFS() throws IOException {
+ createIndex("index.optimized.cfs", true, true);
}
- public void testCreateNoCFS() throws IOException {
- String dirName = "testindex.nocfs";
- createIndex(dirName, true);
- rmDir(dirName);
+ public void testCreateOptimizedNoCFS() throws IOException {
+ createIndex("index.optimized.nocfs", false, true);
}
*/
@@ -454,7 +455,7 @@ public class TestBackwardsCompatibility
dir.close();
}
- public File createIndex(Random random, String dirName, boolean doCFS) throws IOException {
+ public File createIndex(String dirName, boolean doCFS, boolean optimized) throws IOException {
// 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(LuceneTestCase.TEMP_DIR, dirName);
_TestUtil.rmDir(indexDir);
@@ -468,24 +469,30 @@ public class TestBackwardsCompatibility
addDoc(writer, i);
}
assertEquals("wrong doc count", 35, writer.maxDoc());
+ if (optimized) {
+ writer.optimize();
+ }
writer.close();
- // open fresh writer so we get no prx file in the added segment
- conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(10);
- ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundFile(doCFS);
- writer = new IndexWriter(dir, conf);
- addNoProxDoc(writer);
- writer.close();
+ if (!optimized) {
+ // open fresh writer so we get no prx file in the added segment
+ conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(10);
+ ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundFile(doCFS);
+ writer = new IndexWriter(dir, conf);
+ addNoProxDoc(writer);
+ writer.close();
- // Delete one doc so we get a .del file:
- IndexReader reader = IndexReader.open(dir, false);
- Term searchTerm = new Term("id", "7");
- int delCount = reader.deleteDocuments(searchTerm);
- assertEquals("didn't delete the right number of documents", 1, delCount);
+ // Delete one doc so we get a .del file:
+ IndexReader reader = IndexReader.open(dir, false);
+ Term searchTerm = new Term("id", "7");
+ int delCount = reader.deleteDocuments(searchTerm);
+ assertEquals("didn't delete the right number of documents", 1, delCount);
- // Set one norm so we get a .s0 file:
- reader.setNorm(21, "content", conf.getSimilarityProvider().get("content").encodeNormValue(1.5f));
- reader.close();
+ // Set one norm so we get a .s0 file:
+ reader.setNorm(21, "content", conf.getSimilarityProvider().get("content").encodeNormValue(1.5f));
+ reader.close();
+ }
+
dir.close();
return indexDir;