Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-1578: Support for loading unoptimized readers to the constructor of InstantiatedIndex. (Karl Wettin)

Karl-Johan Wettin9e5cb084617c
diff --git a/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestUnoptimizedReaderOnConstructor.java b/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestUnoptimizedReaderOnConstructor.java
index b68af00fd64..298a12786c0 100644
--- a/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestUnoptimizedReaderOnConstructor.java
+++ b/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestUnoptimizedReaderOnConstructor.java
@@ -1,8 +1,24 @@
package org.apache.lucene.store.instantiated;
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
import junit.framework.TestCase;
import java.io.IOException;
+import java.util.Map;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
@@ -13,7 +29,6 @@ import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
/**
- * @author kalle
* @since 2009-mar-30 13:15:49
*/
public class TestUnoptimizedReaderOnConstructor extends TestCase {
@@ -23,25 +38,29 @@ public class TestUnoptimizedReaderOnConstructor extends TestCase {
IndexWriter iw = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.UNLIMITED);
addDocument(iw, "Hello, world!");
addDocument(iw, "All work and no play makes jack a dull boy");
- iw.commit("a");
iw.close();
iw = new IndexWriter(dir, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.UNLIMITED);
addDocument(iw, "Hello, tellus!");
addDocument(iw, "All work and no play makes danny a dull boy");
- iw.commit("b");
iw.close();
iw = new IndexWriter(dir, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.UNLIMITED);
addDocument(iw, "Hello, earth!");
addDocument(iw, "All work and no play makes wendy a dull girl");
- iw.commit("c");
iw.close();
IndexReader unoptimizedReader = IndexReader.open(dir);
unoptimizedReader.deleteDocument(2);
- InstantiatedIndex ii = new InstantiatedIndex(unoptimizedReader);
+ InstantiatedIndex ii;
+ try {
+ ii = new InstantiatedIndex(unoptimizedReader);
+ } catch (Exception e) {
+ fail("No exceptions when loading an unoptimized reader!");
+ }
+
+ // todo some assertations.
}