mirror of https://github.com/apache/lucene.git
LUCENE-1578: Support for loading unoptimized readers to the constructor of InstantiatedIndex. (Karl Wettin)
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@784482 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
196428ec39
commit
9e5cb08461
|
@ -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.
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue