mirror of https://github.com/apache/lucene.git
LUCENE-2595: switch tests to use MockRAMDirectory instead of RAMDirectory
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@984232 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ca4c8f3ae9
commit
d2165cf08e
|
@ -48,7 +48,7 @@ import org.apache.lucene.search.spans.SpanQuery;
|
||||||
import org.apache.lucene.search.spans.SpanTermQuery;
|
import org.apache.lucene.search.spans.SpanTermQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.LockObtainFailedException;
|
import org.apache.lucene.store.LockObtainFailedException;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.OpenBitSet;
|
import org.apache.lucene.util.OpenBitSet;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class HighlighterPhraseTest extends LuceneTestCase {
|
||||||
public void testConcurrentPhrase() throws CorruptIndexException,
|
public void testConcurrentPhrase() throws CorruptIndexException,
|
||||||
LockObtainFailedException, IOException, InvalidTokenOffsetsException {
|
LockObtainFailedException, IOException, InvalidTokenOffsetsException {
|
||||||
final String TEXT = "the fox jumped";
|
final String TEXT = "the fox jumped";
|
||||||
final Directory directory = new RAMDirectory();
|
final Directory directory = new MockRAMDirectory();
|
||||||
final IndexWriter indexWriter = new IndexWriter(directory,
|
final IndexWriter indexWriter = new IndexWriter(directory,
|
||||||
new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
||||||
try {
|
try {
|
||||||
|
@ -101,7 +101,7 @@ public class HighlighterPhraseTest extends LuceneTestCase {
|
||||||
public void testConcurrentSpan() throws CorruptIndexException,
|
public void testConcurrentSpan() throws CorruptIndexException,
|
||||||
LockObtainFailedException, IOException, InvalidTokenOffsetsException {
|
LockObtainFailedException, IOException, InvalidTokenOffsetsException {
|
||||||
final String TEXT = "the fox jumped";
|
final String TEXT = "the fox jumped";
|
||||||
final Directory directory = new RAMDirectory();
|
final Directory directory = new MockRAMDirectory();
|
||||||
final IndexWriter indexWriter = new IndexWriter(directory,
|
final IndexWriter indexWriter = new IndexWriter(directory,
|
||||||
new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
||||||
try {
|
try {
|
||||||
|
@ -170,7 +170,7 @@ public class HighlighterPhraseTest extends LuceneTestCase {
|
||||||
public void testSparsePhrase() throws CorruptIndexException,
|
public void testSparsePhrase() throws CorruptIndexException,
|
||||||
LockObtainFailedException, IOException, InvalidTokenOffsetsException {
|
LockObtainFailedException, IOException, InvalidTokenOffsetsException {
|
||||||
final String TEXT = "the fox did not jump";
|
final String TEXT = "the fox did not jump";
|
||||||
final Directory directory = new RAMDirectory();
|
final Directory directory = new MockRAMDirectory();
|
||||||
final IndexWriter indexWriter = new IndexWriter(directory,
|
final IndexWriter indexWriter = new IndexWriter(directory,
|
||||||
new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
||||||
try {
|
try {
|
||||||
|
@ -212,7 +212,7 @@ public class HighlighterPhraseTest extends LuceneTestCase {
|
||||||
public void testSparsePhraseWithNoPositions() throws CorruptIndexException,
|
public void testSparsePhraseWithNoPositions() throws CorruptIndexException,
|
||||||
LockObtainFailedException, IOException, InvalidTokenOffsetsException {
|
LockObtainFailedException, IOException, InvalidTokenOffsetsException {
|
||||||
final String TEXT = "the fox did not jump";
|
final String TEXT = "the fox did not jump";
|
||||||
final Directory directory = new RAMDirectory();
|
final Directory directory = new MockRAMDirectory();
|
||||||
final IndexWriter indexWriter = new IndexWriter(directory,
|
final IndexWriter indexWriter = new IndexWriter(directory,
|
||||||
new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
||||||
try {
|
try {
|
||||||
|
@ -252,7 +252,7 @@ public class HighlighterPhraseTest extends LuceneTestCase {
|
||||||
public void testSparseSpan() throws CorruptIndexException,
|
public void testSparseSpan() throws CorruptIndexException,
|
||||||
LockObtainFailedException, IOException, InvalidTokenOffsetsException {
|
LockObtainFailedException, IOException, InvalidTokenOffsetsException {
|
||||||
final String TEXT = "the fox did not jump";
|
final String TEXT = "the fox did not jump";
|
||||||
final Directory directory = new RAMDirectory();
|
final Directory directory = new MockRAMDirectory();
|
||||||
final IndexWriter indexWriter = new IndexWriter(directory,
|
final IndexWriter indexWriter = new IndexWriter(directory,
|
||||||
new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -77,7 +77,7 @@ import org.apache.lucene.search.spans.SpanOrQuery;
|
||||||
import org.apache.lucene.search.spans.SpanQuery;
|
import org.apache.lucene.search.spans.SpanQuery;
|
||||||
import org.apache.lucene.search.spans.SpanTermQuery;
|
import org.apache.lucene.search.spans.SpanTermQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.automaton.BasicAutomata;
|
import org.apache.lucene.util.automaton.BasicAutomata;
|
||||||
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
||||||
import org.apache.lucene.util.automaton.RegExp;
|
import org.apache.lucene.util.automaton.RegExp;
|
||||||
|
@ -94,7 +94,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
||||||
static final String FIELD_NAME = "contents";
|
static final String FIELD_NAME = "contents";
|
||||||
private static final String NUMERIC_FIELD_NAME = "nfield";
|
private static final String NUMERIC_FIELD_NAME = "nfield";
|
||||||
private Query query;
|
private Query query;
|
||||||
RAMDirectory ramDir;
|
MockRAMDirectory ramDir;
|
||||||
public IndexSearcher searcher = null;
|
public IndexSearcher searcher = null;
|
||||||
int numHighlights = 0;
|
int numHighlights = 0;
|
||||||
final Analyzer analyzer = new MockAnalyzer(MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET, true);
|
final Analyzer analyzer = new MockAnalyzer(MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET, true);
|
||||||
|
@ -1319,7 +1319,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
||||||
|
|
||||||
public void testMultiSearcher() throws Exception {
|
public void testMultiSearcher() throws Exception {
|
||||||
// setup index 1
|
// setup index 1
|
||||||
RAMDirectory ramDir1 = new RAMDirectory();
|
MockRAMDirectory ramDir1 = new MockRAMDirectory();
|
||||||
IndexWriter writer1 = new IndexWriter(ramDir1, new IndexWriterConfig(
|
IndexWriter writer1 = new IndexWriter(ramDir1, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET, true)));
|
TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET, true)));
|
||||||
Document d = new Document();
|
Document d = new Document();
|
||||||
|
@ -1331,7 +1331,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
||||||
IndexReader reader1 = IndexReader.open(ramDir1, true);
|
IndexReader reader1 = IndexReader.open(ramDir1, true);
|
||||||
|
|
||||||
// setup index 2
|
// setup index 2
|
||||||
RAMDirectory ramDir2 = new RAMDirectory();
|
MockRAMDirectory ramDir2 = new MockRAMDirectory();
|
||||||
IndexWriter writer2 = new IndexWriter(ramDir2, new IndexWriterConfig(
|
IndexWriter writer2 = new IndexWriter(ramDir2, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET, true)));
|
TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET, true)));
|
||||||
d = new Document();
|
d = new Document();
|
||||||
|
@ -1587,7 +1587,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
||||||
helper.start();
|
helper.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Directory dir = new RAMDirectory();
|
private Directory dir = new MockRAMDirectory();
|
||||||
private Analyzer a = new MockAnalyzer(MockTokenizer.WHITESPACE, false);
|
private Analyzer a = new MockAnalyzer(MockTokenizer.WHITESPACE, false);
|
||||||
|
|
||||||
public void testWeightedTermsWithDeletes() throws IOException, ParseException, InvalidTokenOffsetsException {
|
public void testWeightedTermsWithDeletes() throws IOException, ParseException, InvalidTokenOffsetsException {
|
||||||
|
@ -1714,7 +1714,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
ramDir = new RAMDirectory();
|
ramDir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(ramDir, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(ramDir, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET, true)));
|
TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET, true)));
|
||||||
for (int i = 0; i < texts.length; i++) {
|
for (int i = 0; i < texts.length; i++) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.lucene.search.PhraseQuery;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public abstract class AbstractTestCase extends LuceneTestCase {
|
public abstract class AbstractTestCase extends LuceneTestCase {
|
||||||
|
@ -91,7 +91,7 @@ public abstract class AbstractTestCase extends LuceneTestCase {
|
||||||
analyzerK = new MockAnalyzer(MockTokenizer.KEYWORD, false);
|
analyzerK = new MockAnalyzer(MockTokenizer.KEYWORD, false);
|
||||||
paW = new QueryParser(TEST_VERSION_CURRENT, F, analyzerW );
|
paW = new QueryParser(TEST_VERSION_CURRENT, F, analyzerW );
|
||||||
paB = new QueryParser(TEST_VERSION_CURRENT, F, analyzerB );
|
paB = new QueryParser(TEST_VERSION_CURRENT, F, analyzerB );
|
||||||
dir = new RAMDirectory();
|
dir = new MockRAMDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.lucene.search.IndexSearcher;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.search.TopDocs;
|
import org.apache.lucene.search.TopDocs;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class TestEmptyIndex extends LuceneTestCase {
|
public class TestEmptyIndex extends LuceneTestCase {
|
||||||
|
@ -61,7 +61,7 @@ public class TestEmptyIndex extends LuceneTestCase {
|
||||||
|
|
||||||
// make sure a Directory acts the same
|
// make sure a Directory acts the same
|
||||||
|
|
||||||
Directory d = new RAMDirectory();
|
Directory d = new MockRAMDirectory();
|
||||||
new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())).close();
|
new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())).close();
|
||||||
r = IndexReader.open(d, false);
|
r = IndexReader.open(d, false);
|
||||||
testNorms(r);
|
testNorms(r);
|
||||||
|
@ -94,7 +94,7 @@ public class TestEmptyIndex extends LuceneTestCase {
|
||||||
|
|
||||||
// make sure a Directory acts the same
|
// make sure a Directory acts the same
|
||||||
|
|
||||||
Directory d = new RAMDirectory();
|
Directory d = new MockRAMDirectory();
|
||||||
new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())).close();
|
new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())).close();
|
||||||
r = IndexReader.open(d, false);
|
r = IndexReader.open(d, false);
|
||||||
termsEnumTest(r);
|
termsEnumTest(r);
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.lucene.index.FieldsEnum;
|
||||||
import org.apache.lucene.index.TermFreqVector;
|
import org.apache.lucene.index.TermFreqVector;
|
||||||
import org.apache.lucene.index.TermPositionVector;
|
import org.apache.lucene.index.TermPositionVector;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.AttributeImpl;
|
import org.apache.lucene.util.AttributeImpl;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
@ -61,7 +61,7 @@ public class TestIndicesEquals extends LuceneTestCase {
|
||||||
|
|
||||||
|
|
||||||
public void testLoadIndexReader() throws Exception {
|
public void testLoadIndexReader() throws Exception {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
// create dir data
|
// create dir data
|
||||||
IndexWriter indexWriter = new IndexWriter(dir, new IndexWriterConfig(
|
IndexWriter indexWriter = new IndexWriter(dir, new IndexWriterConfig(
|
||||||
|
@ -85,7 +85,7 @@ public class TestIndicesEquals extends LuceneTestCase {
|
||||||
public void testInstantiatedIndexWriter() throws Exception {
|
public void testInstantiatedIndexWriter() throws Exception {
|
||||||
|
|
||||||
|
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
InstantiatedIndex ii = new InstantiatedIndex();
|
InstantiatedIndex ii = new InstantiatedIndex();
|
||||||
|
|
||||||
// create dir data
|
// create dir data
|
||||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.store.instantiated;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
|
@ -34,7 +34,7 @@ public class TestSerialization extends LuceneTestCase {
|
||||||
|
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
|
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.IndexWriterConfig;
|
import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
|
@ -33,7 +33,7 @@ import org.apache.lucene.document.Field;
|
||||||
public class TestUnoptimizedReaderOnConstructor extends LuceneTestCase {
|
public class TestUnoptimizedReaderOnConstructor extends LuceneTestCase {
|
||||||
|
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
addDocument(iw, "Hello, world!");
|
addDocument(iw, "Hello, world!");
|
||||||
addDocument(iw, "All work and no play makes jack a dull boy");
|
addDocument(iw, "All work and no play makes jack a dull boy");
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.queryParser.QueryParser;
|
import org.apache.lucene.queryParser.QueryParser;
|
||||||
import org.apache.lucene.search.IndexSearcher;
|
import org.apache.lucene.search.IndexSearcher;
|
||||||
import org.apache.lucene.search.TopDocs;
|
import org.apache.lucene.search.TopDocs;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util._TestUtil;
|
import org.apache.lucene.util._TestUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,7 +106,7 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase {
|
||||||
termField.append(randomTerm());
|
termField.append(randomTerm());
|
||||||
}
|
}
|
||||||
|
|
||||||
RAMDirectory ramdir = new RAMDirectory();
|
MockRAMDirectory ramdir = new MockRAMDirectory();
|
||||||
Analyzer analyzer = randomAnalyzer();
|
Analyzer analyzer = randomAnalyzer();
|
||||||
IndexWriter writer = new IndexWriter(ramdir,
|
IndexWriter writer = new IndexWriter(ramdir,
|
||||||
new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer).setCodecProvider(_TestUtil.alwaysCodec("Standard")));
|
new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer).setCodecProvider(_TestUtil.alwaysCodec("Standard")));
|
||||||
|
@ -127,7 +127,7 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase {
|
||||||
/**
|
/**
|
||||||
* Run all queries against both the RAMDirectory and MemoryIndex, ensuring they are the same.
|
* Run all queries against both the RAMDirectory and MemoryIndex, ensuring they are the same.
|
||||||
*/
|
*/
|
||||||
public void assertAllQueries(MemoryIndex memory, RAMDirectory ramdir, Analyzer analyzer) throws Exception {
|
public void assertAllQueries(MemoryIndex memory, MockRAMDirectory ramdir, Analyzer analyzer) throws Exception {
|
||||||
IndexSearcher ram = new IndexSearcher(ramdir);
|
IndexSearcher ram = new IndexSearcher(ramdir);
|
||||||
IndexSearcher mem = memory.createSearcher();
|
IndexSearcher mem = memory.createSearcher();
|
||||||
QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "foo", analyzer);
|
QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "foo", analyzer);
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.lucene.search.Scorer;
|
||||||
import org.apache.lucene.search.Similarity;
|
import org.apache.lucene.search.Similarity;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ public class TestFieldNormModifier extends LuceneTestCase {
|
||||||
|
|
||||||
public static int NUM_DOCS = 5;
|
public static int NUM_DOCS = 5;
|
||||||
|
|
||||||
public Directory store = new RAMDirectory();
|
public Directory store = new MockRAMDirectory();
|
||||||
|
|
||||||
/** inverts the normal notion of lengthNorm */
|
/** inverts the normal notion of lengthNorm */
|
||||||
public static Similarity s = new DefaultSimilarity() {
|
public static Similarity s = new DefaultSimilarity() {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class TestMultiPassIndexSplitter extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
Document doc;
|
Document doc;
|
||||||
for (int i = 0; i < NUM_DOCS; i++) {
|
for (int i = 0; i < NUM_DOCS; i++) {
|
||||||
|
@ -53,9 +53,9 @@ public class TestMultiPassIndexSplitter extends LuceneTestCase {
|
||||||
public void testSplitRR() throws Exception {
|
public void testSplitRR() throws Exception {
|
||||||
MultiPassIndexSplitter splitter = new MultiPassIndexSplitter();
|
MultiPassIndexSplitter splitter = new MultiPassIndexSplitter();
|
||||||
Directory[] dirs = new Directory[]{
|
Directory[] dirs = new Directory[]{
|
||||||
new RAMDirectory(),
|
new MockRAMDirectory(),
|
||||||
new RAMDirectory(),
|
new MockRAMDirectory(),
|
||||||
new RAMDirectory()
|
new MockRAMDirectory()
|
||||||
};
|
};
|
||||||
splitter.split(input, dirs, false);
|
splitter.split(input, dirs, false);
|
||||||
IndexReader ir;
|
IndexReader ir;
|
||||||
|
@ -95,9 +95,9 @@ public class TestMultiPassIndexSplitter extends LuceneTestCase {
|
||||||
public void testSplitSeq() throws Exception {
|
public void testSplitSeq() throws Exception {
|
||||||
MultiPassIndexSplitter splitter = new MultiPassIndexSplitter();
|
MultiPassIndexSplitter splitter = new MultiPassIndexSplitter();
|
||||||
Directory[] dirs = new Directory[]{
|
Directory[] dirs = new Directory[]{
|
||||||
new RAMDirectory(),
|
new MockRAMDirectory(),
|
||||||
new RAMDirectory(),
|
new MockRAMDirectory(),
|
||||||
new RAMDirectory()
|
new MockRAMDirectory()
|
||||||
};
|
};
|
||||||
splitter.split(input, dirs, true);
|
splitter.split(input, dirs, true);
|
||||||
IndexReader ir;
|
IndexReader ir;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -27,7 +27,7 @@ public class TestTermVectorAccessor extends LuceneTestCase {
|
||||||
|
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
|
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
|
||||||
Document doc;
|
Document doc;
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.apache.lucene.index.codecs.SegmentInfosReader;
|
||||||
import org.apache.lucene.index.codecs.SegmentInfosWriter;
|
import org.apache.lucene.index.codecs.SegmentInfosWriter;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.IndexOutput;
|
import org.apache.lucene.store.IndexOutput;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.Version;
|
import org.apache.lucene.util.Version;
|
||||||
|
@ -118,7 +118,7 @@ public class TestAppendingCodec extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
private static class AppendingRAMDirectory extends RAMDirectory {
|
private static class AppendingRAMDirectory extends MockRAMDirectory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IndexOutput createOutput(String name) throws IOException {
|
public IndexOutput createOutput(String name) throws IOException {
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.lucene.search.Scorer;
|
||||||
import org.apache.lucene.search.Similarity;
|
import org.apache.lucene.search.Similarity;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +48,7 @@ public class TestLengthNormModifier extends LuceneTestCase {
|
||||||
|
|
||||||
public static int NUM_DOCS = 5;
|
public static int NUM_DOCS = 5;
|
||||||
|
|
||||||
public Directory store = new RAMDirectory();
|
public Directory store = new MockRAMDirectory();
|
||||||
|
|
||||||
/** inverts the normal notion of lengthNorm */
|
/** inverts the normal notion of lengthNorm */
|
||||||
public static Similarity s = new DefaultSimilarity() {
|
public static Similarity s = new DefaultSimilarity() {
|
||||||
|
|
|
@ -27,17 +27,17 @@ import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class BooleanFilterTest extends LuceneTestCase {
|
public class BooleanFilterTest extends LuceneTestCase {
|
||||||
private RAMDirectory directory;
|
private MockRAMDirectory directory;
|
||||||
private IndexReader reader;
|
private IndexReader reader;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory, new MockAnalyzer(MockTokenizer.WHITESPACE, false));
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory, new MockAnalyzer(MockTokenizer.WHITESPACE, false));
|
||||||
|
|
||||||
//Add series of docs with filterable fields : acces rights, prices, dates and "in-stock" flags
|
//Add series of docs with filterable fields : acces rights, prices, dates and "in-stock" flags
|
||||||
|
|
|
@ -39,13 +39,13 @@ import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.search.TermRangeFilter;
|
import org.apache.lucene.search.TermRangeFilter;
|
||||||
import org.apache.lucene.search.TopDocs;
|
import org.apache.lucene.search.TopDocs;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class ChainedFilterTest extends LuceneTestCase {
|
public class ChainedFilterTest extends LuceneTestCase {
|
||||||
public static final int MAX = 500;
|
public static final int MAX = 500;
|
||||||
|
|
||||||
private RAMDirectory directory;
|
private MockRAMDirectory directory;
|
||||||
private IndexSearcher searcher;
|
private IndexSearcher searcher;
|
||||||
private IndexReader reader;
|
private IndexReader reader;
|
||||||
private Query query;
|
private Query query;
|
||||||
|
@ -60,7 +60,7 @@ public class ChainedFilterTest extends LuceneTestCase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
random = newRandom();
|
random = newRandom();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
||||||
Calendar cal = new GregorianCalendar();
|
Calendar cal = new GregorianCalendar();
|
||||||
cal.clear();
|
cal.clear();
|
||||||
|
@ -195,7 +195,7 @@ public class ChainedFilterTest extends LuceneTestCase {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void testWithCachingFilter() throws Exception {
|
public void testWithCachingFilter() throws Exception {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, dir);
|
RandomIndexWriter writer = new RandomIndexWriter(random, dir);
|
||||||
IndexReader reader = writer.getReader();
|
IndexReader reader = writer.getReader();
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
|
@ -27,13 +27,13 @@ import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.index.DocsEnum;
|
import org.apache.lucene.index.DocsEnum;
|
||||||
import org.apache.lucene.index.MultiFields;
|
import org.apache.lucene.index.MultiFields;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
|
||||||
public class DuplicateFilterTest extends LuceneTestCase {
|
public class DuplicateFilterTest extends LuceneTestCase {
|
||||||
private static final String KEY_FIELD = "url";
|
private static final String KEY_FIELD = "url";
|
||||||
private RAMDirectory directory;
|
private MockRAMDirectory directory;
|
||||||
private IndexReader reader;
|
private IndexReader reader;
|
||||||
TermQuery tq=new TermQuery(new Term("text","lucene"));
|
TermQuery tq=new TermQuery(new Term("text","lucene"));
|
||||||
private IndexSearcher searcher;
|
private IndexSearcher searcher;
|
||||||
|
@ -41,7 +41,7 @@ public class DuplicateFilterTest extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
||||||
|
|
||||||
//Add series of docs with filterable fields : url, text and dates flags
|
//Add series of docs with filterable fields : url, text and dates flags
|
||||||
|
|
|
@ -27,11 +27,11 @@ import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class FuzzyLikeThisQueryTest extends LuceneTestCase {
|
public class FuzzyLikeThisQueryTest extends LuceneTestCase {
|
||||||
private RAMDirectory directory;
|
private MockRAMDirectory directory;
|
||||||
private IndexSearcher searcher;
|
private IndexSearcher searcher;
|
||||||
private IndexReader reader;
|
private IndexReader reader;
|
||||||
private Analyzer analyzer=new MockAnalyzer();
|
private Analyzer analyzer=new MockAnalyzer();
|
||||||
|
@ -39,7 +39,7 @@ public class FuzzyLikeThisQueryTest extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
||||||
|
|
||||||
//Add series of docs with misspelt names
|
//Add series of docs with misspelt names
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.OpenBitSet;
|
import org.apache.lucene.util.OpenBitSet;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class TermsFilterTest extends LuceneTestCase {
|
||||||
|
|
||||||
public void testMissingTerms() throws Exception {
|
public void testMissingTerms() throws Exception {
|
||||||
String fieldName="field1";
|
String fieldName="field1";
|
||||||
RAMDirectory rd=new RAMDirectory();
|
MockRAMDirectory rd=new MockRAMDirectory();
|
||||||
RandomIndexWriter w = new RandomIndexWriter(newRandom(), rd);
|
RandomIndexWriter w = new RandomIndexWriter(newRandom(), rd);
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
Document doc=new Document();
|
Document doc=new Document();
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search.regex;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
|
@ -41,7 +41,7 @@ public class TestRegexQuery extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(new Field(FN, "the quick brown fox jumps over the lazy dog", Field.Store.NO, Field.Index.ANALYZED));
|
doc.add(new Field(FN, "the quick brown fox jumps over the lazy dog", Field.Store.NO, Field.Index.ANALYZED));
|
||||||
|
|
|
@ -34,17 +34,17 @@ import org.apache.lucene.search.spans.SpanNearQuery;
|
||||||
import org.apache.lucene.search.spans.SpanQuery;
|
import org.apache.lucene.search.spans.SpanQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.LockObtainFailedException;
|
import org.apache.lucene.store.LockObtainFailedException;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class TestSpanRegexQuery extends LuceneTestCase {
|
public class TestSpanRegexQuery extends LuceneTestCase {
|
||||||
|
|
||||||
Directory indexStoreA = new RAMDirectory();
|
Directory indexStoreA = new MockRAMDirectory();
|
||||||
|
|
||||||
Directory indexStoreB = new RAMDirectory();
|
Directory indexStoreB = new MockRAMDirectory();
|
||||||
|
|
||||||
public void testSpanRegex() throws Exception {
|
public void testSpanRegex() throws Exception {
|
||||||
RAMDirectory directory = new RAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
|
|
@ -33,18 +33,18 @@ import org.apache.lucene.search.BooleanClause;
|
||||||
import org.apache.lucene.search.BooleanQuery;
|
import org.apache.lucene.search.BooleanQuery;
|
||||||
import org.apache.lucene.search.IndexSearcher;
|
import org.apache.lucene.search.IndexSearcher;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class TestMoreLikeThis extends LuceneTestCase {
|
public class TestMoreLikeThis extends LuceneTestCase {
|
||||||
private RAMDirectory directory;
|
private MockRAMDirectory directory;
|
||||||
private IndexReader reader;
|
private IndexReader reader;
|
||||||
private IndexSearcher searcher;
|
private IndexSearcher searcher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
||||||
|
|
||||||
// Add series of docs with specific information for MoreLikeThis
|
// Add series of docs with specific information for MoreLikeThis
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.lucene.search.IndexSearcher;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.ScoreDoc;
|
import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.search.TopDocs;
|
import org.apache.lucene.search.TopDocs;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class TestComplexPhraseQuery extends LuceneTestCase {
|
public class TestComplexPhraseQuery extends LuceneTestCase {
|
||||||
|
@ -112,7 +112,7 @@ public class TestComplexPhraseQuery extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
RAMDirectory rd = new RAMDirectory();
|
MockRAMDirectory rd = new MockRAMDirectory();
|
||||||
IndexWriter w = new IndexWriter(rd, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
|
IndexWriter w = new IndexWriter(rd, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
|
||||||
for (int i = 0; i < docsContent.length; i++) {
|
for (int i = 0; i < docsContent.length; i++) {
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.ScoreDoc;
|
import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.search.BooleanClause.Occur;
|
import org.apache.lucene.search.BooleanClause.Occur;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -319,7 +319,7 @@ public class TestMultiFieldQPHelper extends LuceneTestCase {
|
||||||
|
|
||||||
public void testStopWordSearching() throws Exception {
|
public void testStopWordSearching() throws Exception {
|
||||||
Analyzer analyzer = new MockAnalyzer();
|
Analyzer analyzer = new MockAnalyzer();
|
||||||
Directory ramDir = new RAMDirectory();
|
Directory ramDir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
|
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(new Field("body", "blah the footest blah", Field.Store.NO,
|
doc.add(new Field("body", "blah the footest blah", Field.Store.NO,
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.ScoreDoc;
|
import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.search.BooleanClause.Occur;
|
import org.apache.lucene.search.BooleanClause.Occur;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -321,7 +321,7 @@ public class TestMultiFieldQueryParserWrapper extends LuceneTestCase {
|
||||||
|
|
||||||
public void testStopWordSearching() throws Exception {
|
public void testStopWordSearching() throws Exception {
|
||||||
Analyzer analyzer = new MockAnalyzer();
|
Analyzer analyzer = new MockAnalyzer();
|
||||||
Directory ramDir = new RAMDirectory();
|
Directory ramDir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(ramDir, analyzer, true,
|
IndexWriter iw = new IndexWriter(ramDir, analyzer, true,
|
||||||
IndexWriter.MaxFieldLength.LIMITED);
|
IndexWriter.MaxFieldLength.LIMITED);
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
|
|
@ -72,7 +72,7 @@ import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.search.TermRangeQuery;
|
import org.apache.lucene.search.TermRangeQuery;
|
||||||
import org.apache.lucene.search.WildcardQuery;
|
import org.apache.lucene.search.WildcardQuery;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LocalizedTestCase;
|
import org.apache.lucene.util.LocalizedTestCase;
|
||||||
import org.apache.lucene.util.automaton.BasicAutomata;
|
import org.apache.lucene.util.automaton.BasicAutomata;
|
||||||
|
@ -654,7 +654,7 @@ public class TestQPHelper extends LocalizedTestCase {
|
||||||
|
|
||||||
public void testFarsiRangeCollating() throws Exception {
|
public void testFarsiRangeCollating() throws Exception {
|
||||||
|
|
||||||
RAMDirectory ramDir = new RAMDirectory();
|
MockRAMDirectory ramDir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(new Field("content", "\u0633\u0627\u0628", Field.Store.YES,
|
doc.add(new Field("content", "\u0633\u0627\u0628", Field.Store.YES,
|
||||||
|
@ -1077,7 +1077,7 @@ public class TestQPHelper extends LocalizedTestCase {
|
||||||
|
|
||||||
public void testLocalDateFormat() throws IOException, QueryNodeException {
|
public void testLocalDateFormat() throws IOException, QueryNodeException {
|
||||||
|
|
||||||
RAMDirectory ramDir = new RAMDirectory();
|
MockRAMDirectory ramDir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
||||||
addDateDoc("a", 2005, 12, 2, 10, 15, 33, iw);
|
addDateDoc("a", 2005, 12, 2, 10, 15, 33, iw);
|
||||||
addDateDoc("b", 2005, 12, 4, 22, 15, 00, iw);
|
addDateDoc("b", 2005, 12, 4, 22, 15, 00, iw);
|
||||||
|
|
|
@ -67,7 +67,7 @@ import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.search.TermRangeQuery;
|
import org.apache.lucene.search.TermRangeQuery;
|
||||||
import org.apache.lucene.search.WildcardQuery;
|
import org.apache.lucene.search.WildcardQuery;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LocalizedTestCase;
|
import org.apache.lucene.util.LocalizedTestCase;
|
||||||
import org.apache.lucene.util.automaton.BasicAutomata;
|
import org.apache.lucene.util.automaton.BasicAutomata;
|
||||||
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
||||||
|
@ -654,7 +654,7 @@ public class TestQueryParserWrapper extends LocalizedTestCase {
|
||||||
|
|
||||||
public void testFarsiRangeCollating() throws Exception {
|
public void testFarsiRangeCollating() throws Exception {
|
||||||
|
|
||||||
RAMDirectory ramDir = new RAMDirectory();
|
MockRAMDirectory ramDir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(ramDir, new MockAnalyzer(MockTokenizer.WHITESPACE, false), true,
|
IndexWriter iw = new IndexWriter(ramDir, new MockAnalyzer(MockTokenizer.WHITESPACE, false), true,
|
||||||
IndexWriter.MaxFieldLength.LIMITED);
|
IndexWriter.MaxFieldLength.LIMITED);
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
@ -1062,7 +1062,7 @@ public class TestQueryParserWrapper extends LocalizedTestCase {
|
||||||
|
|
||||||
public void testLocalDateFormat() throws IOException, ParseException {
|
public void testLocalDateFormat() throws IOException, ParseException {
|
||||||
|
|
||||||
RAMDirectory ramDir = new RAMDirectory();
|
MockRAMDirectory ramDir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(ramDir, new MockAnalyzer(MockTokenizer.WHITESPACE, false), true,
|
IndexWriter iw = new IndexWriter(ramDir, new MockAnalyzer(MockTokenizer.WHITESPACE, false), true,
|
||||||
IndexWriter.MaxFieldLength.LIMITED);
|
IndexWriter.MaxFieldLength.LIMITED);
|
||||||
addDateDoc("a", 2005, 12, 2, 10, 15, 33, iw);
|
addDateDoc("a", 2005, 12, 2, 10, 15, 33, iw);
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.queryParser.surround.query;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.Version;
|
import org.apache.lucene.util.Version;
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
|
@ -33,7 +33,7 @@ public class SingleFieldTestDb {
|
||||||
|
|
||||||
public SingleFieldTestDb(String[] documents, String fName) {
|
public SingleFieldTestDb(String[] documents, String fName) {
|
||||||
try {
|
try {
|
||||||
db = new RAMDirectory();
|
db = new MockRAMDirectory();
|
||||||
docs = documents;
|
docs = documents;
|
||||||
fieldName = fName;
|
fieldName = fName;
|
||||||
IndexWriter writer = new IndexWriter(db, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(db, new IndexWriterConfig(
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.IndexWriterConfig;
|
import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public class TestRemoteCachingWrapperFilter extends RemoteTestCaseJ4 {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
// construct an index
|
// construct an index
|
||||||
RAMDirectory indexStore = new RAMDirectory();
|
MockRAMDirectory indexStore = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.lucene.document.*;
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.IndexWriterConfig;
|
import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class TestRemoteSearchable extends RemoteTestCaseJ4 {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
// construct an index
|
// construct an index
|
||||||
RAMDirectory indexStore = new RAMDirectory();
|
MockRAMDirectory indexStore = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.IndexWriterConfig;
|
import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.index.LogMergePolicy;
|
import org.apache.lucene.index.LogMergePolicy;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
@ -82,7 +82,7 @@ public class TestRemoteSort extends RemoteTestCaseJ4 {
|
||||||
// create an index of all the documents, or just the x, or just the y documents
|
// create an index of all the documents, or just the x, or just the y documents
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
RAMDirectory indexStore = new RAMDirectory ();
|
MockRAMDirectory indexStore = new MockRAMDirectory ();
|
||||||
IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
.setMaxBufferedDocs(2));
|
.setMaxBufferedDocs(2));
|
||||||
|
|
|
@ -49,7 +49,7 @@ import org.apache.lucene.spatial.tier.projections.CartesianTierPlotter;
|
||||||
import org.apache.lucene.spatial.tier.projections.IProjector;
|
import org.apache.lucene.spatial.tier.projections.IProjector;
|
||||||
import org.apache.lucene.spatial.tier.projections.SinusoidalProjector;
|
import org.apache.lucene.spatial.tier.projections.SinusoidalProjector;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class TestCartesian extends LuceneTestCase {
|
public class TestCartesian extends LuceneTestCase {
|
||||||
|
@ -71,7 +71,7 @@ public class TestCartesian extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
|
||||||
|
|
|
@ -29,11 +29,11 @@ import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.search.QueryWrapperFilter;
|
import org.apache.lucene.search.QueryWrapperFilter;
|
||||||
import org.apache.lucene.search.MatchAllDocsQuery;
|
import org.apache.lucene.search.MatchAllDocsQuery;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
public class TestDistance extends LuceneTestCase {
|
public class TestDistance extends LuceneTestCase {
|
||||||
|
|
||||||
private RAMDirectory directory;
|
private MockRAMDirectory directory;
|
||||||
// reston va
|
// reston va
|
||||||
private double lat = 38.969398;
|
private double lat = 38.969398;
|
||||||
private double lng= -77.386398;
|
private double lng= -77.386398;
|
||||||
|
@ -44,7 +44,7 @@ public class TestDistance extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
addData(writer);
|
addData(writer);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.IndexWriterConfig;
|
import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +39,7 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
*/
|
*/
|
||||||
public class TestLuceneDictionary extends LuceneTestCase {
|
public class TestLuceneDictionary extends LuceneTestCase {
|
||||||
|
|
||||||
private Directory store = new RAMDirectory();
|
private Directory store = new MockRAMDirectory();
|
||||||
|
|
||||||
private IndexReader indexReader = null;
|
private IndexReader indexReader = null;
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ public class TestLuceneDictionary extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSpellchecker() throws IOException {
|
public void testSpellchecker() throws IOException {
|
||||||
SpellChecker sc = new SpellChecker(new RAMDirectory());
|
SpellChecker sc = new SpellChecker(new MockRAMDirectory());
|
||||||
indexReader = IndexReader.open(store, true);
|
indexReader = IndexReader.open(store, true);
|
||||||
sc.indexDictionary(new LuceneDictionary(indexReader, "contents"));
|
sc.indexDictionary(new LuceneDictionary(indexReader, "contents"));
|
||||||
String[] suggestions = sc.suggestSimilar("Tam", 1);
|
String[] suggestions = sc.suggestSimilar("Tam", 1);
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.search.spell;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,7 @@ public class TestPlainTextDictionary extends LuceneTestCase {
|
||||||
final String LF = System.getProperty("line.separator");
|
final String LF = System.getProperty("line.separator");
|
||||||
String input = "oneword" + LF + "twoword" + LF + "threeword";
|
String input = "oneword" + LF + "twoword" + LF + "threeword";
|
||||||
PlainTextDictionary ptd = new PlainTextDictionary(new StringReader(input));
|
PlainTextDictionary ptd = new PlainTextDictionary(new StringReader(input));
|
||||||
RAMDirectory ramDir = new RAMDirectory();
|
MockRAMDirectory ramDir = new MockRAMDirectory();
|
||||||
SpellChecker spellChecker = new SpellChecker(ramDir);
|
SpellChecker spellChecker = new SpellChecker(ramDir);
|
||||||
spellChecker.indexDictionary(ptd);
|
spellChecker.indexDictionary(ptd);
|
||||||
String[] similar = spellChecker.suggestSimilar("treeword", 2);
|
String[] similar = spellChecker.suggestSimilar("treeword", 2);
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.search.IndexSearcher;
|
import org.apache.lucene.search.IndexSearcher;
|
||||||
import org.apache.lucene.store.AlreadyClosedException;
|
import org.apache.lucene.store.AlreadyClosedException;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.English;
|
import org.apache.lucene.util.English;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class TestSpellChecker extends LuceneTestCase {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
//create a user index
|
//create a user index
|
||||||
userindex = new RAMDirectory();
|
userindex = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(userindex, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(userindex, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class TestSpellChecker extends LuceneTestCase {
|
||||||
writer.close();
|
writer.close();
|
||||||
searchers = Collections.synchronizedList(new ArrayList<IndexSearcher>());
|
searchers = Collections.synchronizedList(new ArrayList<IndexSearcher>());
|
||||||
// create the spellChecker
|
// create the spellChecker
|
||||||
spellindex = new RAMDirectory();
|
spellindex = new MockRAMDirectory();
|
||||||
spellChecker = new SpellCheckerMock(spellindex);
|
spellChecker = new SpellCheckerMock(spellindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.ScoreDoc;
|
import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.search.TopDocs;
|
import org.apache.lucene.search.TopDocs;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.Version;
|
import org.apache.lucene.util.Version;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
/**
|
/**
|
||||||
|
@ -62,7 +62,7 @@ public class TestParser extends LuceneTestCase {
|
||||||
if(dir==null)
|
if(dir==null)
|
||||||
{
|
{
|
||||||
BufferedReader d = new BufferedReader(new InputStreamReader(TestParser.class.getResourceAsStream("reuters21578.txt")));
|
BufferedReader d = new BufferedReader(new InputStreamReader(TestParser.class.getResourceAsStream("reuters21578.txt")));
|
||||||
dir=new RAMDirectory();
|
dir=new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(Version.LUCENE_24, analyzer));
|
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(Version.LUCENE_24, analyzer));
|
||||||
String line = d.readLine();
|
String line = d.readLine();
|
||||||
while(line!=null)
|
while(line!=null)
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.IndexWriterConfig;
|
import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.search.IndexSearcher;
|
import org.apache.lucene.search.IndexSearcher;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -141,7 +141,7 @@ public class TestQueryTemplateManager extends LuceneTestCase {
|
||||||
|
|
||||||
|
|
||||||
//Create an index
|
//Create an index
|
||||||
RAMDirectory dir=new RAMDirectory();
|
MockRAMDirectory dir=new MockRAMDirectory();
|
||||||
IndexWriter w=new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
|
IndexWriter w=new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
|
||||||
for (int i = 0; i < docFieldValues.length; i++)
|
for (int i = 0; i < docFieldValues.length; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.index.IndexWriter.MaxFieldLength;
|
import org.apache.lucene.index.IndexWriter.MaxFieldLength;
|
||||||
import org.apache.lucene.search.Filter;
|
import org.apache.lucene.search.Filter;
|
||||||
import org.apache.lucene.search.NumericRangeFilter;
|
import org.apache.lucene.search.NumericRangeFilter;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.xmlparser.ParserException;
|
import org.apache.lucene.xmlparser.ParserException;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -62,7 +62,7 @@ public class TestNumericRangeFilterBuilder extends LuceneTestCase {
|
||||||
Document doc = getDocumentFromString(xml);
|
Document doc = getDocumentFromString(xml);
|
||||||
Filter filter = filterBuilder.getFilter(doc.getDocumentElement());
|
Filter filter = filterBuilder.getFilter(doc.getDocumentElement());
|
||||||
|
|
||||||
RAMDirectory ramDir = new RAMDirectory();
|
MockRAMDirectory ramDir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, null));
|
IndexWriter writer = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, null));
|
||||||
writer.commit();
|
writer.commit();
|
||||||
try
|
try
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.search.ScoreDoc;
|
import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +49,7 @@ public class TestDemo extends LuceneTestCase {
|
||||||
Analyzer analyzer = new MockAnalyzer();
|
Analyzer analyzer = new MockAnalyzer();
|
||||||
|
|
||||||
// Store the index in memory:
|
// Store the index in memory:
|
||||||
Directory directory = new RAMDirectory();
|
Directory directory = new MockRAMDirectory();
|
||||||
// To store an index on disk, use this instead:
|
// To store an index on disk, use this instead:
|
||||||
//Directory directory = FSDirectory.open("/tmp/testindex");
|
//Directory directory = FSDirectory.open("/tmp/testindex");
|
||||||
IndexWriter iwriter = new IndexWriter(directory, new IndexWriterConfig(
|
IndexWriter iwriter = new IndexWriter(directory, new IndexWriterConfig(
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class TestSearch extends LuceneTestCase {
|
||||||
|
|
||||||
private void doTestSearch(PrintWriter out, boolean useCompoundFile)
|
private void doTestSearch(PrintWriter out, boolean useCompoundFile)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
Directory directory = new RAMDirectory();
|
Directory directory = new MockRAMDirectory();
|
||||||
Analyzer analyzer = new MockAnalyzer();
|
Analyzer analyzer = new MockAnalyzer();
|
||||||
IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
|
IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
|
||||||
LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
|
LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class TestSearchForDuplicates extends LuceneTestCase {
|
||||||
|
|
||||||
|
|
||||||
private void doTest(PrintWriter out, boolean useCompoundFiles) throws Exception {
|
private void doTest(PrintWriter out, boolean useCompoundFiles) throws Exception {
|
||||||
Directory directory = new RAMDirectory();
|
Directory directory = new MockRAMDirectory();
|
||||||
Analyzer analyzer = new MockAnalyzer();
|
Analyzer analyzer = new MockAnalyzer();
|
||||||
IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
|
IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
|
||||||
LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
|
LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
|
||||||
|
|
|
@ -31,14 +31,14 @@ import org.apache.lucene.index.MultiFields;
|
||||||
import org.apache.lucene.index.DocsAndPositionsEnum;
|
import org.apache.lucene.index.DocsAndPositionsEnum;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
|
||||||
public class TestCachingTokenFilter extends BaseTokenStreamTestCase {
|
public class TestCachingTokenFilter extends BaseTokenStreamTestCase {
|
||||||
private String[] tokens = new String[] {"term1", "term2", "term3", "term2"};
|
private String[] tokens = new String[] {"term1", "term2", "term3", "term2"};
|
||||||
|
|
||||||
public void testCaching() throws IOException {
|
public void testCaching() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), dir);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), dir);
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
TokenStream stream = new TokenStream() {
|
TokenStream stream = new TokenStream() {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.ScoreDoc;
|
import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.search.Searcher;
|
import org.apache.lucene.search.Searcher;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -152,7 +152,7 @@ public class TestDocument extends LuceneTestCase {
|
||||||
* @throws Exception on error
|
* @throws Exception on error
|
||||||
*/
|
*/
|
||||||
public void testGetValuesForIndexedDocument() throws Exception {
|
public void testGetValuesForIndexedDocument() throws Exception {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), dir);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), dir);
|
||||||
writer.addDocument(makeDocumentWithFields());
|
writer.addDocument(makeDocumentWithFields());
|
||||||
IndexReader reader = writer.getReader();
|
IndexReader reader = writer.getReader();
|
||||||
|
@ -230,7 +230,7 @@ public class TestDocument extends LuceneTestCase {
|
||||||
doc.add(new Field("keyword", "test", Field.Store.YES,
|
doc.add(new Field("keyword", "test", Field.Store.YES,
|
||||||
Field.Index.NOT_ANALYZED));
|
Field.Index.NOT_ANALYZED));
|
||||||
|
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), dir);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), dir);
|
||||||
writer.addDocument(doc);
|
writer.addDocument(doc);
|
||||||
field.setValue("id2");
|
field.setValue("id2");
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util._TestUtil;
|
import org.apache.lucene.util._TestUtil;
|
||||||
|
|
||||||
|
@ -44,10 +44,10 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
|
|
||||||
public void testSimpleCase() throws IOException {
|
public void testSimpleCase() throws IOException {
|
||||||
// main directory
|
// main directory
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
// two auxiliary directories
|
// two auxiliary directories
|
||||||
Directory aux = new RAMDirectory();
|
Directory aux = new MockRAMDirectory();
|
||||||
Directory aux2 = new RAMDirectory();
|
Directory aux2 = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = null;
|
IndexWriter writer = null;
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
verifyNumDocs(dir, 190);
|
verifyNumDocs(dir, 190);
|
||||||
|
|
||||||
// now add another set in.
|
// now add another set in.
|
||||||
Directory aux3 = new RAMDirectory();
|
Directory aux3 = new MockRAMDirectory();
|
||||||
writer = newWriter(aux3, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
writer = newWriter(aux3, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
// add 40 documents
|
// add 40 documents
|
||||||
addDocs(writer, 40);
|
addDocs(writer, 40);
|
||||||
|
@ -123,7 +123,7 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
verifyTermDocs(dir, new Term("content", "bbb"), 50);
|
verifyTermDocs(dir, new Term("content", "bbb"), 50);
|
||||||
|
|
||||||
// now add a single document
|
// now add a single document
|
||||||
Directory aux4 = new RAMDirectory();
|
Directory aux4 = new MockRAMDirectory();
|
||||||
writer = newWriter(aux4, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
writer = newWriter(aux4, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
addDocs2(writer, 1);
|
addDocs2(writer, 1);
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -178,9 +178,9 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
|
|
||||||
public void testWithPendingDeletes2() throws IOException {
|
public void testWithPendingDeletes2() throws IOException {
|
||||||
// main directory
|
// main directory
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
// auxiliary directory
|
// auxiliary directory
|
||||||
Directory aux = new RAMDirectory();
|
Directory aux = new MockRAMDirectory();
|
||||||
|
|
||||||
setUpDirs(dir, aux);
|
setUpDirs(dir, aux);
|
||||||
IndexWriter writer = newWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setOpenMode(OpenMode.APPEND));
|
IndexWriter writer = newWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setOpenMode(OpenMode.APPEND));
|
||||||
|
@ -216,9 +216,9 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
|
|
||||||
public void testWithPendingDeletes3() throws IOException {
|
public void testWithPendingDeletes3() throws IOException {
|
||||||
// main directory
|
// main directory
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
// auxiliary directory
|
// auxiliary directory
|
||||||
Directory aux = new RAMDirectory();
|
Directory aux = new MockRAMDirectory();
|
||||||
|
|
||||||
setUpDirs(dir, aux);
|
setUpDirs(dir, aux);
|
||||||
IndexWriter writer = newWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setOpenMode(OpenMode.APPEND));
|
IndexWriter writer = newWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setOpenMode(OpenMode.APPEND));
|
||||||
|
@ -256,9 +256,9 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
// case 0: add self or exceed maxMergeDocs, expect exception
|
// case 0: add self or exceed maxMergeDocs, expect exception
|
||||||
public void testAddSelf() throws IOException {
|
public void testAddSelf() throws IOException {
|
||||||
// main directory
|
// main directory
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
// auxiliary directory
|
// auxiliary directory
|
||||||
Directory aux = new RAMDirectory();
|
Directory aux = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = null;
|
IndexWriter writer = null;
|
||||||
|
|
||||||
|
@ -300,9 +300,9 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
// case 1: no tail segments
|
// case 1: no tail segments
|
||||||
public void testNoTailSegments() throws IOException {
|
public void testNoTailSegments() throws IOException {
|
||||||
// main directory
|
// main directory
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
// auxiliary directory
|
// auxiliary directory
|
||||||
Directory aux = new RAMDirectory();
|
Directory aux = new MockRAMDirectory();
|
||||||
|
|
||||||
setUpDirs(dir, aux);
|
setUpDirs(dir, aux);
|
||||||
|
|
||||||
|
@ -324,9 +324,9 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
// case 2: tail segments, invariants hold, no copy
|
// case 2: tail segments, invariants hold, no copy
|
||||||
public void testNoCopySegments() throws IOException {
|
public void testNoCopySegments() throws IOException {
|
||||||
// main directory
|
// main directory
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
// auxiliary directory
|
// auxiliary directory
|
||||||
Directory aux = new RAMDirectory();
|
Directory aux = new MockRAMDirectory();
|
||||||
|
|
||||||
setUpDirs(dir, aux);
|
setUpDirs(dir, aux);
|
||||||
|
|
||||||
|
@ -346,9 +346,9 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
// case 3: tail segments, invariants hold, copy, invariants hold
|
// case 3: tail segments, invariants hold, copy, invariants hold
|
||||||
public void testNoMergeAfterCopy() throws IOException {
|
public void testNoMergeAfterCopy() throws IOException {
|
||||||
// main directory
|
// main directory
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
// auxiliary directory
|
// auxiliary directory
|
||||||
Directory aux = new RAMDirectory();
|
Directory aux = new MockRAMDirectory();
|
||||||
|
|
||||||
setUpDirs(dir, aux);
|
setUpDirs(dir, aux);
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
.setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(10));
|
.setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(10));
|
||||||
((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
|
((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
|
||||||
|
|
||||||
writer.addIndexes(new Directory[] { aux, new RAMDirectory(aux) });
|
writer.addIndexes(new Directory[] { aux, new MockRAMDirectory(aux) });
|
||||||
assertEquals(1060, writer.maxDoc());
|
assertEquals(1060, writer.maxDoc());
|
||||||
assertEquals(1000, writer.getDocCount(0));
|
assertEquals(1000, writer.getDocCount(0));
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -369,9 +369,9 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
// case 4: tail segments, invariants hold, copy, invariants not hold
|
// case 4: tail segments, invariants hold, copy, invariants not hold
|
||||||
public void testMergeAfterCopy() throws IOException {
|
public void testMergeAfterCopy() throws IOException {
|
||||||
// main directory
|
// main directory
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
// auxiliary directory
|
// auxiliary directory
|
||||||
Directory aux = new RAMDirectory();
|
Directory aux = new MockRAMDirectory();
|
||||||
|
|
||||||
setUpDirs(dir, aux);
|
setUpDirs(dir, aux);
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
.setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(4));
|
.setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(4));
|
||||||
((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
|
((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
|
||||||
|
|
||||||
writer.addIndexes(new Directory[] { aux, new RAMDirectory(aux) });
|
writer.addIndexes(new Directory[] { aux, new MockRAMDirectory(aux) });
|
||||||
assertEquals(1060, writer.maxDoc());
|
assertEquals(1060, writer.maxDoc());
|
||||||
assertEquals(1000, writer.getDocCount(0));
|
assertEquals(1000, writer.getDocCount(0));
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -396,10 +396,10 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
// case 5: tail segments, invariants not hold
|
// case 5: tail segments, invariants not hold
|
||||||
public void testMoreMerges() throws IOException {
|
public void testMoreMerges() throws IOException {
|
||||||
// main directory
|
// main directory
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
// auxiliary directory
|
// auxiliary directory
|
||||||
Directory aux = new RAMDirectory();
|
Directory aux = new MockRAMDirectory();
|
||||||
Directory aux2 = new RAMDirectory();
|
Directory aux2 = new MockRAMDirectory();
|
||||||
|
|
||||||
setUpDirs(dir, aux);
|
setUpDirs(dir, aux);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.search.NumericRangeQuery;
|
import org.apache.lucene.search.NumericRangeQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.FSDirectory;
|
import org.apache.lucene.store.FSDirectory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util._TestUtil;
|
import org.apache.lucene.util._TestUtil;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
@ -226,7 +226,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
||||||
String fullPath = fullDir(name);
|
String fullPath = fullDir(name);
|
||||||
Directory dir = FSDirectory.open(new File(fullPath));
|
Directory dir = FSDirectory.open(new File(fullPath));
|
||||||
|
|
||||||
Directory targetDir = new RAMDirectory();
|
Directory targetDir = new MockRAMDirectory();
|
||||||
IndexWriter w = new IndexWriter(targetDir, newIndexWriterConfig(random,
|
IndexWriter w = new IndexWriter(targetDir, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
w.addIndexes(new Directory[] { dir });
|
w.addIndexes(new Directory[] { dir });
|
||||||
|
@ -247,7 +247,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
||||||
Directory dir = FSDirectory.open(new File(fullPath));
|
Directory dir = FSDirectory.open(new File(fullPath));
|
||||||
IndexReader reader = IndexReader.open(dir);
|
IndexReader reader = IndexReader.open(dir);
|
||||||
|
|
||||||
Directory targetDir = new RAMDirectory();
|
Directory targetDir = new MockRAMDirectory();
|
||||||
IndexWriter w = new IndexWriter(targetDir, newIndexWriterConfig(random,
|
IndexWriter w = new IndexWriter(targetDir, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
w.addIndexes(new IndexReader[] { reader });
|
w.addIndexes(new IndexReader[] { reader });
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.ScoreDoc;
|
import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.apache.lucene.util.MultiCodecTestCase;
|
import org.apache.lucene.util.MultiCodecTestCase;
|
||||||
import org.apache.lucene.util.Version;
|
import org.apache.lucene.util.Version;
|
||||||
|
@ -352,7 +352,7 @@ public class TestCodecs extends MultiCodecTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSepPositionAfterMerge() throws IOException {
|
public void testSepPositionAfterMerge() throws IOException {
|
||||||
final Directory dir = new RAMDirectory();
|
final Directory dir = new MockRAMDirectory();
|
||||||
final IndexWriterConfig config = newIndexWriterConfig(newRandom(), Version.LUCENE_31,
|
final IndexWriterConfig config = newIndexWriterConfig(newRandom(), Version.LUCENE_31,
|
||||||
new MockAnalyzer());
|
new MockAnalyzer());
|
||||||
config.setCodecProvider(new MockSepCodecs());
|
config.setCodecProvider(new MockSepCodecs());
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.index;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
|
@ -108,7 +108,7 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
|
||||||
// before it finishes, are correctly merged back:
|
// before it finishes, are correctly merged back:
|
||||||
public void testDeleteMerging() throws IOException {
|
public void testDeleteMerging() throws IOException {
|
||||||
|
|
||||||
RAMDirectory directory = new MockRAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
|
|
||||||
LogDocMergePolicy mp = new LogDocMergePolicy();
|
LogDocMergePolicy mp = new LogDocMergePolicy();
|
||||||
// Force degenerate merging so we can get a mix of
|
// Force degenerate merging so we can get a mix of
|
||||||
|
@ -147,7 +147,7 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
|
||||||
|
|
||||||
public void testNoExtraFiles() throws IOException {
|
public void testNoExtraFiles() throws IOException {
|
||||||
|
|
||||||
RAMDirectory directory = new MockRAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
|
@ -176,7 +176,7 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNoWaitClose() throws IOException {
|
public void testNoWaitClose() throws IOException {
|
||||||
RAMDirectory directory = new MockRAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
Field idField = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
|
Field idField = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.ScoreDoc;
|
import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ public class TestDeletionPolicy extends LuceneTestCase {
|
||||||
boolean useCompoundFile = true;
|
boolean useCompoundFile = true;
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
|
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
ExpirationTimeDeletionPolicy policy = new ExpirationTimeDeletionPolicy(dir, SECONDS);
|
ExpirationTimeDeletionPolicy policy = new ExpirationTimeDeletionPolicy(dir, SECONDS);
|
||||||
IndexWriterConfig conf = newIndexWriterConfig(random, TEST_VERSION_CURRENT,
|
IndexWriterConfig conf = newIndexWriterConfig(random, TEST_VERSION_CURRENT,
|
||||||
new MockAnalyzer())
|
new MockAnalyzer())
|
||||||
|
@ -282,7 +282,7 @@ public class TestDeletionPolicy extends LuceneTestCase {
|
||||||
// Never deletes a commit
|
// Never deletes a commit
|
||||||
KeepAllDeletionPolicy policy = new KeepAllDeletionPolicy();
|
KeepAllDeletionPolicy policy = new KeepAllDeletionPolicy();
|
||||||
|
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
policy.dir = dir;
|
policy.dir = dir;
|
||||||
|
|
||||||
IndexWriterConfig conf = newIndexWriterConfig(random,
|
IndexWriterConfig conf = newIndexWriterConfig(random,
|
||||||
|
@ -474,7 +474,7 @@ public class TestDeletionPolicy extends LuceneTestCase {
|
||||||
|
|
||||||
KeepNoneOnInitDeletionPolicy policy = new KeepNoneOnInitDeletionPolicy();
|
KeepNoneOnInitDeletionPolicy policy = new KeepNoneOnInitDeletionPolicy();
|
||||||
|
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriterConfig conf = newIndexWriterConfig(random,
|
IndexWriterConfig conf = newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
|
@ -523,7 +523,7 @@ public class TestDeletionPolicy extends LuceneTestCase {
|
||||||
|
|
||||||
boolean useCompoundFile = (pass % 2) != 0;
|
boolean useCompoundFile = (pass % 2) != 0;
|
||||||
|
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
KeepLastNDeletionPolicy policy = new KeepLastNDeletionPolicy(N);
|
KeepLastNDeletionPolicy policy = new KeepLastNDeletionPolicy(N);
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@ public class TestDeletionPolicy extends LuceneTestCase {
|
||||||
|
|
||||||
KeepLastNDeletionPolicy policy = new KeepLastNDeletionPolicy(N);
|
KeepLastNDeletionPolicy policy = new KeepLastNDeletionPolicy(N);
|
||||||
|
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriterConfig conf = newIndexWriterConfig(random,
|
IndexWriterConfig conf = newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
.setOpenMode(OpenMode.CREATE).setIndexDeletionPolicy(policy);
|
.setOpenMode(OpenMode.CREATE).setIndexDeletionPolicy(policy);
|
||||||
|
@ -646,7 +646,7 @@ public class TestDeletionPolicy extends LuceneTestCase {
|
||||||
|
|
||||||
dir.deleteFile(IndexFileNames.SEGMENTS_GEN);
|
dir.deleteFile(IndexFileNames.SEGMENTS_GEN);
|
||||||
int expectedCount = 176;
|
int expectedCount = 176;
|
||||||
|
searcher.close();
|
||||||
for(int i=0;i<N+1;i++) {
|
for(int i=0;i<N+1;i++) {
|
||||||
try {
|
try {
|
||||||
IndexReader reader = IndexReader.open(dir, true);
|
IndexReader reader = IndexReader.open(dir, true);
|
||||||
|
@ -678,7 +678,6 @@ public class TestDeletionPolicy extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
gen--;
|
gen--;
|
||||||
}
|
}
|
||||||
|
|
||||||
dir.close();
|
dir.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -698,7 +697,7 @@ public class TestDeletionPolicy extends LuceneTestCase {
|
||||||
|
|
||||||
KeepLastNDeletionPolicy policy = new KeepLastNDeletionPolicy(N);
|
KeepLastNDeletionPolicy policy = new KeepLastNDeletionPolicy(N);
|
||||||
|
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriterConfig conf = newIndexWriterConfig(random,
|
IndexWriterConfig conf = newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
.setOpenMode(OpenMode.CREATE).setIndexDeletionPolicy(policy)
|
.setOpenMode(OpenMode.CREATE).setIndexDeletionPolicy(policy)
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -45,7 +45,7 @@ public class TestDirectoryReader extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
dir = new RAMDirectory();
|
dir = new MockRAMDirectory();
|
||||||
doc1 = new Document();
|
doc1 = new Document();
|
||||||
doc2 = new Document();
|
doc2 = new Document();
|
||||||
DocHelper.setupDoc(doc1);
|
DocHelper.setupDoc(doc1);
|
||||||
|
@ -126,9 +126,9 @@ public class TestDirectoryReader extends LuceneTestCase {
|
||||||
|
|
||||||
public void testIsCurrent() throws IOException {
|
public void testIsCurrent() throws IOException {
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
RAMDirectory ramDir1=new RAMDirectory();
|
MockRAMDirectory ramDir1=new MockRAMDirectory();
|
||||||
addDoc(random, ramDir1, "test foo", true);
|
addDoc(random, ramDir1, "test foo", true);
|
||||||
RAMDirectory ramDir2=new RAMDirectory();
|
MockRAMDirectory ramDir2=new MockRAMDirectory();
|
||||||
addDoc(random, ramDir2, "test blah", true);
|
addDoc(random, ramDir2, "test blah", true);
|
||||||
IndexReader[] readers = new IndexReader[]{IndexReader.open(ramDir1, false), IndexReader.open(ramDir2, false)};
|
IndexReader[] readers = new IndexReader[]{IndexReader.open(ramDir1, false), IndexReader.open(ramDir2, false)};
|
||||||
MultiReader mr = new MultiReader(readers);
|
MultiReader mr = new MultiReader(readers);
|
||||||
|
@ -148,11 +148,11 @@ public class TestDirectoryReader extends LuceneTestCase {
|
||||||
|
|
||||||
public void testMultiTermDocs() throws IOException {
|
public void testMultiTermDocs() throws IOException {
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
RAMDirectory ramDir1=new RAMDirectory();
|
MockRAMDirectory ramDir1=new MockRAMDirectory();
|
||||||
addDoc(random, ramDir1, "test foo", true);
|
addDoc(random, ramDir1, "test foo", true);
|
||||||
RAMDirectory ramDir2=new RAMDirectory();
|
MockRAMDirectory ramDir2=new MockRAMDirectory();
|
||||||
addDoc(random, ramDir2, "test blah", true);
|
addDoc(random, ramDir2, "test blah", true);
|
||||||
RAMDirectory ramDir3=new RAMDirectory();
|
MockRAMDirectory ramDir3=new MockRAMDirectory();
|
||||||
addDoc(random, ramDir3, "test wow", true);
|
addDoc(random, ramDir3, "test wow", true);
|
||||||
|
|
||||||
IndexReader[] readers1 = new IndexReader[]{IndexReader.open(ramDir1, false), IndexReader.open(ramDir3, false)};
|
IndexReader[] readers1 = new IndexReader[]{IndexReader.open(ramDir1, false), IndexReader.open(ramDir3, false)};
|
||||||
|
@ -184,7 +184,7 @@ public class TestDirectoryReader extends LuceneTestCase {
|
||||||
assertTrue(ret > 0);
|
assertTrue(ret > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDoc(Random random, RAMDirectory ramDir1, String s, boolean create) throws IOException {
|
private void addDoc(Random random, MockRAMDirectory ramDir1, String s, boolean create) throws IOException {
|
||||||
IndexWriter iw = new IndexWriter(ramDir1, newIndexWriterConfig(random,
|
IndexWriter iw = new IndexWriter(ramDir1, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT,
|
TEST_VERSION_CURRENT,
|
||||||
new MockAnalyzer()).setOpenMode(
|
new MockAnalyzer()).setOpenMode(
|
||||||
|
|
|
@ -34,14 +34,14 @@ import org.apache.lucene.document.Fieldable;
|
||||||
import org.apache.lucene.document.Field.Index;
|
import org.apache.lucene.document.Field.Index;
|
||||||
import org.apache.lucene.document.Field.Store;
|
import org.apache.lucene.document.Field.Store;
|
||||||
import org.apache.lucene.document.Field.TermVector;
|
import org.apache.lucene.document.Field.TermVector;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.AttributeSource;
|
import org.apache.lucene.util.AttributeSource;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util._TestUtil;
|
import org.apache.lucene.util._TestUtil;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
|
||||||
public class TestDocumentWriter extends LuceneTestCase {
|
public class TestDocumentWriter extends LuceneTestCase {
|
||||||
private RAMDirectory dir;
|
private MockRAMDirectory dir;
|
||||||
|
|
||||||
public TestDocumentWriter(String s) {
|
public TestDocumentWriter(String s) {
|
||||||
super(s);
|
super(s);
|
||||||
|
@ -50,7 +50,7 @@ public class TestDocumentWriter extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
dir = new RAMDirectory();
|
dir = new MockRAMDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test() {
|
public void test() {
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.index;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.IndexOutput;
|
import org.apache.lucene.store.IndexOutput;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -47,7 +47,7 @@ public class TestFieldInfos extends LuceneTestCase {
|
||||||
fieldInfos.add(testDoc);
|
fieldInfos.add(testDoc);
|
||||||
//Since the complement is stored as well in the fields map
|
//Since the complement is stored as well in the fields map
|
||||||
assertTrue(fieldInfos.size() == DocHelper.all.size()); //this is all b/c we are using the no-arg constructor
|
assertTrue(fieldInfos.size() == DocHelper.all.size()); //this is all b/c we are using the no-arg constructor
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
String name = "testFile";
|
String name = "testFile";
|
||||||
IndexOutput output = dir.createOutput(name);
|
IndexOutput output = dir.createOutput(name);
|
||||||
assertTrue(output != null);
|
assertTrue(output != null);
|
||||||
|
|
|
@ -40,12 +40,12 @@ import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.FSDirectory;
|
import org.apache.lucene.store.FSDirectory;
|
||||||
import org.apache.lucene.store.IndexInput;
|
import org.apache.lucene.store.IndexInput;
|
||||||
import org.apache.lucene.store.IndexOutput;
|
import org.apache.lucene.store.IndexOutput;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util._TestUtil;
|
import org.apache.lucene.util._TestUtil;
|
||||||
|
|
||||||
public class TestFieldsReader extends LuceneTestCase {
|
public class TestFieldsReader extends LuceneTestCase {
|
||||||
private RAMDirectory dir = new RAMDirectory();
|
private MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
private Document testDoc = new Document();
|
private Document testDoc = new Document();
|
||||||
private FieldInfos fieldInfos = null;
|
private FieldInfos fieldInfos = null;
|
||||||
private Random random;
|
private Random random;
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
import junit.textui.TestRunner;
|
import junit.textui.TestRunner;
|
||||||
|
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
|
@ -132,7 +132,7 @@ public class TestFilterIndexReader extends LuceneTestCase {
|
||||||
*/
|
*/
|
||||||
public void testFilterIndexReader() throws Exception {
|
public void testFilterIndexReader() throws Exception {
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
RAMDirectory directory = new MockRAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
|
||||||
Document d1 = new Document();
|
Document d1 = new Document();
|
||||||
|
@ -150,7 +150,7 @@ public class TestFilterIndexReader extends LuceneTestCase {
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
//IndexReader reader = new TestReader(IndexReader.open(directory, true));
|
//IndexReader reader = new TestReader(IndexReader.open(directory, true));
|
||||||
RAMDirectory target = new MockRAMDirectory();
|
MockRAMDirectory target = new MockRAMDirectory();
|
||||||
writer = new IndexWriter(target, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
writer = new IndexWriter(target, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
IndexReader reader = new TestReader(IndexReader.open(directory, true));
|
IndexReader reader = new TestReader(IndexReader.open(directory, true));
|
||||||
writer.addIndexes(reader);
|
writer.addIndexes(reader);
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCaseJ4;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class TestIndexCommit extends LuceneTestCaseJ4 {
|
||||||
@Test
|
@Test
|
||||||
public void testEqualsHashCode() throws Exception {
|
public void testEqualsHashCode() throws Exception {
|
||||||
// LUCENE-2417: equals and hashCode() impl was inconsistent
|
// LUCENE-2417: equals and hashCode() impl was inconsistent
|
||||||
final Directory dir = new RAMDirectory();
|
final Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexCommit ic1 = new IndexCommit() {
|
IndexCommit ic1 = new IndexCommit() {
|
||||||
@Override public String getSegmentsFileName() { return "a"; }
|
@Override public String getSegmentsFileName() { return "a"; }
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.IndexInput;
|
import org.apache.lucene.store.IndexInput;
|
||||||
import org.apache.lucene.store.IndexOutput;
|
import org.apache.lucene.store.IndexOutput;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
|
@ -39,8 +39,8 @@ public class TestIndexFileDeleter extends LuceneTestCase {
|
||||||
|
|
||||||
public void testDeleteLeftoverFiles() throws IOException {
|
public void testDeleteLeftoverFiles() throws IOException {
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
Directory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
|
dir.setPreventDoubleWrite(false);
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
.setMaxBufferedDocs(10));
|
.setMaxBufferedDocs(10));
|
||||||
|
@ -135,14 +135,14 @@ public class TestIndexFileDeleter extends LuceneTestCase {
|
||||||
|
|
||||||
// Create a bogus fnm file when the CFS already exists:
|
// Create a bogus fnm file when the CFS already exists:
|
||||||
copyFile(dir, "_0.cfs", "_0.fnm");
|
copyFile(dir, "_0.cfs", "_0.fnm");
|
||||||
|
|
||||||
// Create some old segments file:
|
// Create some old segments file:
|
||||||
copyFile(dir, "segments_2", "segments");
|
copyFile(dir, "segments_2", "segments");
|
||||||
copyFile(dir, "segments_2", "segments_1");
|
copyFile(dir, "segments_2", "segments_1");
|
||||||
|
|
||||||
// Create a bogus cfs file shadowing a non-cfs segment:
|
// Create a bogus cfs file shadowing a non-cfs segment:
|
||||||
copyFile(dir, "_1.cfs", "_2.cfs");
|
copyFile(dir, "_1.cfs", "_2.cfs");
|
||||||
|
|
||||||
String[] filesPre = dir.listAll();
|
String[] filesPre = dir.listAll();
|
||||||
|
|
||||||
// Open & close a writer: it should delete the above 4
|
// Open & close a writer: it should delete the above 4
|
||||||
|
|
|
@ -53,7 +53,7 @@ import org.apache.lucene.store.FSDirectory;
|
||||||
import org.apache.lucene.store.LockObtainFailedException;
|
import org.apache.lucene.store.LockObtainFailedException;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.NoSuchDirectoryException;
|
import org.apache.lucene.store.NoSuchDirectoryException;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util._TestUtil;
|
import org.apache.lucene.util._TestUtil;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
@ -83,7 +83,7 @@ public class TestIndexReader extends LuceneTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCommitUserData() throws Exception {
|
public void testCommitUserData() throws Exception {
|
||||||
RAMDirectory d = new MockRAMDirectory();
|
MockRAMDirectory d = new MockRAMDirectory();
|
||||||
|
|
||||||
Map<String,String> commitUserData = new HashMap<String,String>();
|
Map<String,String> commitUserData = new HashMap<String,String>();
|
||||||
commitUserData.put("foo", "fighters");
|
commitUserData.put("foo", "fighters");
|
||||||
|
@ -138,7 +138,7 @@ public class TestIndexReader extends LuceneTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIsCurrent() throws Exception {
|
public void testIsCurrent() throws Exception {
|
||||||
RAMDirectory d = new MockRAMDirectory();
|
MockRAMDirectory d = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(d, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(d, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
addDocumentWithFields(writer);
|
addDocumentWithFields(writer);
|
||||||
|
@ -167,7 +167,7 @@ public class TestIndexReader extends LuceneTestCase
|
||||||
* @throws Exception on error
|
* @throws Exception on error
|
||||||
*/
|
*/
|
||||||
public void testGetFieldNames() throws Exception {
|
public void testGetFieldNames() throws Exception {
|
||||||
RAMDirectory d = new MockRAMDirectory();
|
MockRAMDirectory d = new MockRAMDirectory();
|
||||||
// set up writer
|
// set up writer
|
||||||
IndexWriter writer = new IndexWriter(d, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(d, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
@ -259,7 +259,7 @@ public class TestIndexReader extends LuceneTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTermVectors() throws Exception {
|
public void testTermVectors() throws Exception {
|
||||||
RAMDirectory d = new MockRAMDirectory();
|
MockRAMDirectory d = new MockRAMDirectory();
|
||||||
// set up writer
|
// set up writer
|
||||||
IndexWriter writer = new IndexWriter(d, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(d, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
@ -356,7 +356,7 @@ public class TestIndexReader extends LuceneTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBinaryFields() throws IOException {
|
public void testBinaryFields() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
byte[] bin = new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
byte[] bin = new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||||
|
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
@ -426,7 +426,7 @@ public class TestIndexReader extends LuceneTestCase
|
||||||
// Make sure attempts to make changes after reader is
|
// Make sure attempts to make changes after reader is
|
||||||
// closed throws IOException:
|
// closed throws IOException:
|
||||||
public void testChangesAfterClose() throws IOException {
|
public void testChangesAfterClose() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = null;
|
IndexWriter writer = null;
|
||||||
IndexReader reader = null;
|
IndexReader reader = null;
|
||||||
|
@ -469,7 +469,7 @@ public class TestIndexReader extends LuceneTestCase
|
||||||
|
|
||||||
// Make sure we get lock obtain failed exception with 2 writers:
|
// Make sure we get lock obtain failed exception with 2 writers:
|
||||||
public void testLockObtainFailed() throws IOException {
|
public void testLockObtainFailed() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
Term searchTerm = new Term("content", "aaa");
|
Term searchTerm = new Term("content", "aaa");
|
||||||
|
|
||||||
|
@ -878,7 +878,7 @@ public class TestIndexReader extends LuceneTestCase
|
||||||
int END_COUNT = 144;
|
int END_COUNT = 144;
|
||||||
|
|
||||||
// First build up a starting index:
|
// First build up a starting index:
|
||||||
RAMDirectory startDir = new MockRAMDirectory();
|
MockRAMDirectory startDir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(startDir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(startDir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
for(int i=0;i<157;i++) {
|
for(int i=0;i<157;i++) {
|
||||||
Document d = new Document();
|
Document d = new Document();
|
||||||
|
@ -1381,7 +1381,7 @@ public class TestIndexReader extends LuceneTestCase
|
||||||
|
|
||||||
public void testGetIndexCommit() throws IOException {
|
public void testGetIndexCommit() throws IOException {
|
||||||
|
|
||||||
RAMDirectory d = new MockRAMDirectory();
|
MockRAMDirectory d = new MockRAMDirectory();
|
||||||
|
|
||||||
// set up writer
|
// set up writer
|
||||||
IndexWriter writer = new IndexWriter(d, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(d, newIndexWriterConfig(random,
|
||||||
|
@ -1430,7 +1430,7 @@ public class TestIndexReader extends LuceneTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReadOnly() throws Throwable {
|
public void testReadOnly() throws Throwable {
|
||||||
RAMDirectory d = new MockRAMDirectory();
|
MockRAMDirectory d = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(d, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(d, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
addDocumentWithFields(writer);
|
addDocumentWithFields(writer);
|
||||||
|
@ -1498,7 +1498,7 @@ public class TestIndexReader extends LuceneTestCase
|
||||||
|
|
||||||
// LUCENE-1474
|
// LUCENE-1474
|
||||||
public void testIndexReader() throws Exception {
|
public void testIndexReader() throws Exception {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
writer.addDocument(createDocument("a"));
|
writer.addDocument(createDocument("a"));
|
||||||
|
|
|
@ -70,7 +70,7 @@ import org.apache.lucene.store.Lock;
|
||||||
import org.apache.lucene.store.LockFactory;
|
import org.apache.lucene.store.LockFactory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.NoLockFactory;
|
import org.apache.lucene.store.NoLockFactory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.SingleInstanceLockFactory;
|
import org.apache.lucene.store.SingleInstanceLockFactory;
|
||||||
import org.apache.lucene.util.UnicodeUtil;
|
import org.apache.lucene.util.UnicodeUtil;
|
||||||
import org.apache.lucene.util._TestUtil;
|
import org.apache.lucene.util._TestUtil;
|
||||||
|
@ -91,7 +91,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDocCount() throws IOException {
|
public void testDocCount() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = null;
|
IndexWriter writer = null;
|
||||||
IndexReader reader = null;
|
IndexReader reader = null;
|
||||||
|
@ -187,7 +187,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
Directory[] dirs = new Directory[NUM_DIR];
|
Directory[] dirs = new Directory[NUM_DIR];
|
||||||
long inputDiskUsage = 0;
|
long inputDiskUsage = 0;
|
||||||
for(int i=0;i<NUM_DIR;i++) {
|
for(int i=0;i<NUM_DIR;i++) {
|
||||||
dirs[i] = new RAMDirectory();
|
dirs[i] = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dirs[i], newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(dirs[i], newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
for(int j=0;j<25;j++) {
|
for(int j=0;j<25;j++) {
|
||||||
addDocWithIndex(writer, 25*i+j);
|
addDocWithIndex(writer, 25*i+j);
|
||||||
|
@ -201,7 +201,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
|
|
||||||
// Now, build a starting index that has START_COUNT docs. We
|
// Now, build a starting index that has START_COUNT docs. We
|
||||||
// will then try to addIndexesNoOptimize into a copy of this:
|
// will then try to addIndexesNoOptimize into a copy of this:
|
||||||
RAMDirectory startDir = new RAMDirectory();
|
MockRAMDirectory startDir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(startDir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(startDir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
for(int j=0;j<START_COUNT;j++) {
|
for(int j=0;j<START_COUNT;j++) {
|
||||||
addDocWithIndex(writer, j);
|
addDocWithIndex(writer, j);
|
||||||
|
@ -714,7 +714,8 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
// gracefully fallback to the previous segments file),
|
// gracefully fallback to the previous segments file),
|
||||||
// and that we can add to the index:
|
// and that we can add to the index:
|
||||||
public void testSimulatedCrashedWriter() throws IOException {
|
public void testSimulatedCrashedWriter() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
|
dir.setPreventDoubleWrite(false);
|
||||||
|
|
||||||
IndexWriter writer = null;
|
IndexWriter writer = null;
|
||||||
|
|
||||||
|
@ -775,7 +776,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
// latest segments file and make sure we get an
|
// latest segments file and make sure we get an
|
||||||
// IOException trying to open the index:
|
// IOException trying to open the index:
|
||||||
public void testSimulatedCorruptIndex1() throws IOException {
|
public void testSimulatedCorruptIndex1() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = null;
|
IndexWriter writer = null;
|
||||||
|
|
||||||
|
@ -818,7 +819,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testChangesAfterClose() throws IOException {
|
public void testChangesAfterClose() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = null;
|
IndexWriter writer = null;
|
||||||
|
|
||||||
|
@ -840,7 +841,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
// files and make sure we get an IOException trying to
|
// files and make sure we get an IOException trying to
|
||||||
// open the index:
|
// open the index:
|
||||||
public void testSimulatedCorruptIndex2() throws IOException {
|
public void testSimulatedCorruptIndex2() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = null;
|
IndexWriter writer = null;
|
||||||
|
|
||||||
|
@ -886,7 +887,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
* these docs until writer is closed.
|
* these docs until writer is closed.
|
||||||
*/
|
*/
|
||||||
public void testCommitOnClose() throws IOException {
|
public void testCommitOnClose() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
for (int i = 0; i < 14; i++) {
|
for (int i = 0; i < 14; i++) {
|
||||||
addDoc(writer);
|
addDoc(writer);
|
||||||
|
@ -1049,7 +1050,8 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
* and close().
|
* and close().
|
||||||
*/
|
*/
|
||||||
public void testCommitOnCloseOptimize() throws IOException {
|
public void testCommitOnCloseOptimize() throws IOException {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
|
dir.setPreventDoubleWrite(false); // TODO: should this be disabled here?
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10));
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10));
|
||||||
((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(10);
|
((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(10);
|
||||||
for(int j=0;j<17;j++) {
|
for(int j=0;j<17;j++) {
|
||||||
|
@ -1093,7 +1095,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIndexNoDocuments() throws IOException {
|
public void testIndexNoDocuments() throws IOException {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
writer.commit();
|
writer.commit();
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -1114,7 +1116,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testManyFields() throws IOException {
|
public void testManyFields() throws IOException {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10));
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10));
|
||||||
for(int j=0;j<100;j++) {
|
for(int j=0;j<100;j++) {
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
@ -1144,7 +1146,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSmallRAMBuffer() throws IOException {
|
public void testSmallRAMBuffer() throws IOException {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setRAMBufferSizeMB(0.000001));
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setRAMBufferSizeMB(0.000001));
|
||||||
((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
|
((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
|
||||||
int lastNumFile = dir.listAll().length;
|
int lastNumFile = dir.listAll().length;
|
||||||
|
@ -1171,7 +1173,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
* session won't be possible.
|
* session won't be possible.
|
||||||
*/
|
*/
|
||||||
public void testChangingRAMBuffer() throws IOException {
|
public void testChangingRAMBuffer() throws IOException {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10).setRAMBufferSizeMB(
|
TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10).setRAMBufferSizeMB(
|
||||||
IndexWriterConfig.DISABLE_AUTO_FLUSH));
|
IndexWriterConfig.DISABLE_AUTO_FLUSH));
|
||||||
|
@ -1229,7 +1231,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
* changing those settings on IW won't be possible.
|
* changing those settings on IW won't be possible.
|
||||||
*/
|
*/
|
||||||
public void testChangingRAMBuffer2() throws IOException {
|
public void testChangingRAMBuffer2() throws IOException {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10).setMaxBufferedDeleteTerms(
|
TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10).setMaxBufferedDeleteTerms(
|
||||||
10).setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH));
|
10).setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH));
|
||||||
|
@ -1288,7 +1290,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDiverseDocs() throws IOException {
|
public void testDiverseDocs() throws IOException {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setRAMBufferSizeMB(0.5));
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setRAMBufferSizeMB(0.5));
|
||||||
for(int i=0;i<3;i++) {
|
for(int i=0;i<3;i++) {
|
||||||
// First, docs where every term is unique (heavy on
|
// First, docs where every term is unique (heavy on
|
||||||
|
@ -1335,7 +1337,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEnablingNorms() throws IOException {
|
public void testEnablingNorms() throws IOException {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10));
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10));
|
||||||
// Enable norms for only 1 doc, pre flush
|
// Enable norms for only 1 doc, pre flush
|
||||||
for(int j=0;j<10;j++) {
|
for(int j=0;j<10;j++) {
|
||||||
|
@ -1381,7 +1383,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHighFreqTerm() throws IOException {
|
public void testHighFreqTerm() throws IOException {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxFieldLength(100000000).setRAMBufferSizeMB(0.01));
|
TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxFieldLength(100000000).setRAMBufferSizeMB(0.01));
|
||||||
// Massive doc that has 128 K a's
|
// Massive doc that has 128 K a's
|
||||||
|
@ -1419,7 +1421,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
// compatibility.
|
// compatibility.
|
||||||
public void testNullLockFactory() throws IOException {
|
public void testNullLockFactory() throws IOException {
|
||||||
|
|
||||||
final class MyRAMDirectory extends RAMDirectory {
|
final class MyRAMDirectory extends MockRAMDirectory {
|
||||||
private LockFactory myLockFactory;
|
private LockFactory myLockFactory;
|
||||||
MyRAMDirectory() {
|
MyRAMDirectory() {
|
||||||
lockFactory = null;
|
lockFactory = null;
|
||||||
|
@ -1442,17 +1444,17 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
IndexSearcher searcher = new IndexSearcher(dir, false);
|
IndexSearcher searcher = new IndexSearcher(dir, false);
|
||||||
ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
|
ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
|
||||||
assertEquals("did not get right number of hits", 100, hits.length);
|
assertEquals("did not get right number of hits", 100, hits.length);
|
||||||
writer.close();
|
searcher.close();
|
||||||
|
|
||||||
writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer())
|
writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
.setOpenMode(OpenMode.CREATE));
|
.setOpenMode(OpenMode.CREATE));
|
||||||
writer.close();
|
writer.close();
|
||||||
|
searcher.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFlushWithNoMerging() throws IOException {
|
public void testFlushWithNoMerging() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2));
|
TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2));
|
||||||
((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
|
((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
|
||||||
|
@ -1472,7 +1474,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
// Make sure we can flush segment w/ norms, then add
|
// Make sure we can flush segment w/ norms, then add
|
||||||
// empty doc (no norms) and flush
|
// empty doc (no norms) and flush
|
||||||
public void testEmptyDocAfterFlushingRealDoc() throws IOException {
|
public void testEmptyDocAfterFlushingRealDoc() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(new Field("field", "aaa", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
|
doc.add(new Field("field", "aaa", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
|
||||||
|
@ -1678,7 +1680,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
|
|
||||||
// LUCENE-1072
|
// LUCENE-1072
|
||||||
public void testExceptionFromTokenStream() throws IOException {
|
public void testExceptionFromTokenStream() throws IOException {
|
||||||
RAMDirectory dir = new MockRAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriterConfig conf = newIndexWriterConfig(random, TEST_VERSION_CURRENT, new Analyzer() {
|
IndexWriterConfig conf = newIndexWriterConfig(random, TEST_VERSION_CURRENT, new Analyzer() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2080,7 +2082,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNoWaitClose() throws Throwable {
|
public void testNoWaitClose() throws Throwable {
|
||||||
RAMDirectory directory = new MockRAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
|
|
||||||
final Document doc = new Document();
|
final Document doc = new Document();
|
||||||
Field idField = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
|
Field idField = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
|
||||||
|
@ -4005,7 +4007,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOptimizeExceptions() throws IOException {
|
public void testOptimizeExceptions() throws IOException {
|
||||||
RAMDirectory startDir = new MockRAMDirectory();
|
MockRAMDirectory startDir = new MockRAMDirectory();
|
||||||
IndexWriterConfig conf = newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2);
|
IndexWriterConfig conf = newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2);
|
||||||
((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(100);
|
((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(100);
|
||||||
IndexWriter w = new IndexWriter(startDir, conf);
|
IndexWriter w = new IndexWriter(startDir, conf);
|
||||||
|
@ -4341,7 +4343,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter w = null;
|
IndexWriter w = null;
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
while(!finish) {
|
while(!finish) {
|
||||||
|
@ -4939,7 +4941,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
// Tests that if we don't call commit(), the directory has 0 commits. This has
|
// Tests that if we don't call commit(), the directory has 0 commits. This has
|
||||||
// changed since LUCENE-2386, where before IW would always commit on a fresh
|
// changed since LUCENE-2386, where before IW would always commit on a fresh
|
||||||
// new index.
|
// new index.
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
try {
|
try {
|
||||||
IndexReader.listCommits(dir);
|
IndexReader.listCommits(dir);
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.lucene.index.codecs.CodecProvider;
|
||||||
import org.apache.lucene.search.DefaultSimilarity;
|
import org.apache.lucene.search.DefaultSimilarity;
|
||||||
import org.apache.lucene.search.Similarity;
|
import org.apache.lucene.search.Similarity;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCaseJ4;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ public class TestIndexWriterConfig extends LuceneTestCaseJ4 {
|
||||||
// iw.getConfig().getXYZ(), he'll get the same value he passed to
|
// iw.getConfig().getXYZ(), he'll get the same value he passed to
|
||||||
// iw.setXYZ().
|
// iw.setXYZ().
|
||||||
IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer());
|
IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer());
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, conf);
|
IndexWriter writer = new IndexWriter(dir, conf);
|
||||||
|
|
||||||
writer.setSimilarity(new MySimilarity());
|
writer.setSimilarity(new MySimilarity());
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util._TestUtil;
|
import org.apache.lucene.util._TestUtil;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
@ -33,7 +33,7 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
|
||||||
|
|
||||||
// Test the normal case
|
// Test the normal case
|
||||||
public void testNormalCase() throws IOException {
|
public void testNormalCase() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
|
@ -49,7 +49,7 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
|
||||||
|
|
||||||
// Test to see if there is over merge
|
// Test to see if there is over merge
|
||||||
public void testNoOverMerge() throws IOException {
|
public void testNoOverMerge() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
|
@ -70,7 +70,7 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
|
||||||
|
|
||||||
// Test the case where flush is forced after every addDoc
|
// Test the case where flush is forced after every addDoc
|
||||||
public void testForceFlush() throws IOException {
|
public void testForceFlush() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
LogDocMergePolicy mp = new LogDocMergePolicy();
|
LogDocMergePolicy mp = new LogDocMergePolicy();
|
||||||
mp.setMinMergeDocs(100);
|
mp.setMinMergeDocs(100);
|
||||||
|
@ -97,7 +97,7 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
|
||||||
|
|
||||||
// Test the case where mergeFactor changes
|
// Test the case where mergeFactor changes
|
||||||
public void testMergeFactorChange() throws IOException {
|
public void testMergeFactorChange() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
|
@ -122,7 +122,7 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
|
||||||
|
|
||||||
// Test the case where both mergeFactor and maxBufferedDocs change
|
// Test the case where both mergeFactor and maxBufferedDocs change
|
||||||
public void testMaxBufferedDocsChange() throws IOException {
|
public void testMaxBufferedDocsChange() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
|
@ -170,7 +170,7 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
|
||||||
|
|
||||||
// Test the case where a merge results in no doc at all
|
// Test the case where a merge results in no doc at all
|
||||||
public void testMergeDocCount0() throws IOException {
|
public void testMergeDocCount0() throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
LogDocMergePolicy ldmp = new LogDocMergePolicy();
|
LogDocMergePolicy ldmp = new LogDocMergePolicy();
|
||||||
ldmp.setMergeFactor(100);
|
ldmp.setMergeFactor(100);
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.lucene.document.FieldSelector;
|
||||||
import org.apache.lucene.document.FieldSelectorResult;
|
import org.apache.lucene.document.FieldSelectorResult;
|
||||||
import org.apache.lucene.document.Fieldable;
|
import org.apache.lucene.document.Fieldable;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class TestLazyBug extends LuceneTestCase {
|
||||||
};
|
};
|
||||||
|
|
||||||
private Directory makeIndex() throws RuntimeException {
|
private Directory makeIndex() throws RuntimeException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
try {
|
try {
|
||||||
Random r = newRandom();
|
Random r = newRandom();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(r,
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(r,
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.search.Searcher;
|
import org.apache.lucene.search.Searcher;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.IndexInput;
|
import org.apache.lucene.store.IndexInput;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class TestLazyProxSkipping extends LuceneTestCase {
|
||||||
private String term2 = "yy";
|
private String term2 = "yy";
|
||||||
private String term3 = "zz";
|
private String term3 = "zz";
|
||||||
|
|
||||||
private class SeekCountingDirectory extends RAMDirectory {
|
private class SeekCountingDirectory extends MockRAMDirectory {
|
||||||
@Override
|
@Override
|
||||||
public IndexInput openInput(String name) throws IOException {
|
public IndexInput openInput(String name) throws IOException {
|
||||||
IndexInput ii = super.openInput(name);
|
IndexInput ii = super.openInput(name);
|
||||||
|
@ -120,7 +120,7 @@ public class TestLazyProxSkipping extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSeek() throws IOException {
|
public void testSeek() throws IOException {
|
||||||
Directory directory = new RAMDirectory();
|
Directory directory = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig(newRandom(), TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig(newRandom(), TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
|
|
@ -20,12 +20,12 @@ package org.apache.lucene.index;
|
||||||
import org.apache.lucene.analysis.Analyzer;
|
import org.apache.lucene.analysis.Analyzer;
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.index.IndexWriter.MaxFieldLength;
|
import org.apache.lucene.index.IndexWriter.MaxFieldLength;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class TestNewestSegment extends LuceneTestCase {
|
public class TestNewestSegment extends LuceneTestCase {
|
||||||
public void testNewestSegment() throws Exception {
|
public void testNewestSegment() throws Exception {
|
||||||
RAMDirectory directory = new RAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
Analyzer analyzer = new MockAnalyzer();
|
Analyzer analyzer = new MockAnalyzer();
|
||||||
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig(newRandom(), TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig(newRandom(), TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
assertNull(writer.newestSegment());
|
assertNull(writer.newestSegment());
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.Field.Index;
|
import org.apache.lucene.document.Field.Index;
|
||||||
import org.apache.lucene.document.Field.Store;
|
import org.apache.lucene.document.Field.Store;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCaseJ4;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class TestNoDeletionPolicy extends LuceneTestCaseJ4 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllCommitsRemain() throws Exception {
|
public void testAllCommitsRemain() throws Exception {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(newRandom(),
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(newRandom(),
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
.setIndexDeletionPolicy(NoDeletionPolicy.INSTANCE));
|
.setIndexDeletionPolicy(NoDeletionPolicy.INSTANCE));
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.search.DefaultSimilarity;
|
import org.apache.lucene.search.DefaultSimilarity;
|
||||||
import org.apache.lucene.search.Similarity;
|
import org.apache.lucene.search.Similarity;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +76,7 @@ public class TestNorms extends LuceneTestCase {
|
||||||
*/
|
*/
|
||||||
public void testNorms() throws IOException {
|
public void testNorms() throws IOException {
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
Directory dir1 = new RAMDirectory();
|
Directory dir1 = new MockRAMDirectory();
|
||||||
|
|
||||||
norms = new ArrayList<Float>();
|
norms = new ArrayList<Float>();
|
||||||
modifiedNorms = new ArrayList<Float>();
|
modifiedNorms = new ArrayList<Float>();
|
||||||
|
@ -93,13 +93,13 @@ public class TestNorms extends LuceneTestCase {
|
||||||
modifiedNorms = new ArrayList<Float>();
|
modifiedNorms = new ArrayList<Float>();
|
||||||
numDocNorms = 0;
|
numDocNorms = 0;
|
||||||
|
|
||||||
Directory dir2 = new RAMDirectory();
|
Directory dir2 = new MockRAMDirectory();
|
||||||
|
|
||||||
createIndex(random, dir2);
|
createIndex(random, dir2);
|
||||||
doTestNorms(random, dir2);
|
doTestNorms(random, dir2);
|
||||||
|
|
||||||
// add index1 and index2 to a third index: index3
|
// add index1 and index2 to a third index: index3
|
||||||
Directory dir3 = new RAMDirectory();
|
Directory dir3 = new MockRAMDirectory();
|
||||||
|
|
||||||
createIndex(random, dir3);
|
createIndex(random, dir3);
|
||||||
IndexWriter iw = new IndexWriter(dir3, newIndexWriterConfig(random,
|
IndexWriter iw = new IndexWriter(dir3, newIndexWriterConfig(random,
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.search.BooleanClause.Occur;
|
import org.apache.lucene.search.BooleanClause.Occur;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class TestParallelReader extends LuceneTestCase {
|
public class TestParallelReader extends LuceneTestCase {
|
||||||
|
@ -262,7 +262,7 @@ public class TestParallelReader extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Directory getDir2(Random random) throws IOException {
|
private Directory getDir2(Random random) throws IOException {
|
||||||
Directory dir2 = new RAMDirectory();
|
Directory dir2 = new MockRAMDirectory();
|
||||||
IndexWriter w2 = new IndexWriter(dir2, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter w2 = new IndexWriter(dir2, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
Document d3 = new Document();
|
Document d3 = new Document();
|
||||||
d3.add(new Field("f3", "v1", Field.Store.YES, Field.Index.ANALYZED));
|
d3.add(new Field("f3", "v1", Field.Store.YES, Field.Index.ANALYZED));
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.lucene.document.Field.Store;
|
||||||
import org.apache.lucene.document.Field.TermVector;
|
import org.apache.lucene.document.Field.TermVector;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some tests for {@link ParallelReader}s with empty indexes
|
* Some tests for {@link ParallelReader}s with empty indexes
|
||||||
|
@ -48,13 +48,13 @@ public class TestParallelReaderEmptyIndex extends LuceneTestCase {
|
||||||
*/
|
*/
|
||||||
public void testEmptyIndex() throws IOException {
|
public void testEmptyIndex() throws IOException {
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
RAMDirectory rd1 = new MockRAMDirectory();
|
MockRAMDirectory rd1 = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(rd1, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iw = new IndexWriter(rd1, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
iw.close();
|
iw.close();
|
||||||
|
|
||||||
RAMDirectory rd2 = new MockRAMDirectory(rd1);
|
MockRAMDirectory rd2 = new MockRAMDirectory(rd1);
|
||||||
|
|
||||||
RAMDirectory rdOut = new MockRAMDirectory();
|
MockRAMDirectory rdOut = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter iwOut = new IndexWriter(rdOut, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iwOut = new IndexWriter(rdOut, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
ParallelReader pr = new ParallelReader();
|
ParallelReader pr = new ParallelReader();
|
||||||
|
@ -78,7 +78,7 @@ public class TestParallelReaderEmptyIndex extends LuceneTestCase {
|
||||||
* any exception.
|
* any exception.
|
||||||
*/
|
*/
|
||||||
public void testEmptyIndexWithVectors() throws IOException {
|
public void testEmptyIndexWithVectors() throws IOException {
|
||||||
RAMDirectory rd1 = new MockRAMDirectory();
|
MockRAMDirectory rd1 = new MockRAMDirectory();
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
{
|
{
|
||||||
IndexWriter iw = new IndexWriter(rd1, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iw = new IndexWriter(rd1, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
@ -100,7 +100,7 @@ public class TestParallelReaderEmptyIndex extends LuceneTestCase {
|
||||||
iw.close();
|
iw.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
RAMDirectory rd2 = new MockRAMDirectory();
|
MockRAMDirectory rd2 = new MockRAMDirectory();
|
||||||
{
|
{
|
||||||
IndexWriter iw = new IndexWriter(rd2, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iw = new IndexWriter(rd2, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
@ -108,7 +108,7 @@ public class TestParallelReaderEmptyIndex extends LuceneTestCase {
|
||||||
iw.close();
|
iw.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
RAMDirectory rdOut = new MockRAMDirectory();
|
MockRAMDirectory rdOut = new MockRAMDirectory();
|
||||||
|
|
||||||
IndexWriter iwOut = new IndexWriter(rdOut, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iwOut = new IndexWriter(rdOut, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
ParallelReader pr = new ParallelReader();
|
ParallelReader pr = new ParallelReader();
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.Field.Index;
|
import org.apache.lucene.document.Field.Index;
|
||||||
import org.apache.lucene.document.Field.Store;
|
import org.apache.lucene.document.Field.Store;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.Bits;
|
import org.apache.lucene.util.Bits;
|
||||||
|
|
||||||
public class TestParallelTermEnum extends LuceneTestCase {
|
public class TestParallelTermEnum extends LuceneTestCase {
|
||||||
|
@ -38,7 +38,7 @@ public class TestParallelTermEnum extends LuceneTestCase {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
Document doc;
|
Document doc;
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
RAMDirectory rd1 = new RAMDirectory();
|
MockRAMDirectory rd1 = new MockRAMDirectory();
|
||||||
IndexWriter iw1 = new IndexWriter(rd1, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iw1 = new IndexWriter(rd1, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
|
||||||
doc = new Document();
|
doc = new Document();
|
||||||
|
@ -50,7 +50,7 @@ public class TestParallelTermEnum extends LuceneTestCase {
|
||||||
iw1.addDocument(doc);
|
iw1.addDocument(doc);
|
||||||
|
|
||||||
iw1.close();
|
iw1.close();
|
||||||
RAMDirectory rd2 = new RAMDirectory();
|
MockRAMDirectory rd2 = new MockRAMDirectory();
|
||||||
IndexWriter iw2 = new IndexWriter(rd2, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iw2 = new IndexWriter(rd2, newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
|
||||||
doc = new Document();
|
doc = new Document();
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.index;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.store.BufferedIndexInput;
|
import org.apache.lucene.store.BufferedIndexInput;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.index.codecs.CodecProvider;
|
import org.apache.lucene.index.codecs.CodecProvider;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
@ -30,14 +30,14 @@ import java.util.Collection;
|
||||||
|
|
||||||
public class TestSegmentMerger extends LuceneTestCase {
|
public class TestSegmentMerger extends LuceneTestCase {
|
||||||
//The variables for the new merged segment
|
//The variables for the new merged segment
|
||||||
private Directory mergedDir = new RAMDirectory();
|
private Directory mergedDir = new MockRAMDirectory();
|
||||||
private String mergedSegment = "test";
|
private String mergedSegment = "test";
|
||||||
//First segment to be merged
|
//First segment to be merged
|
||||||
private Directory merge1Dir = new RAMDirectory();
|
private Directory merge1Dir = new MockRAMDirectory();
|
||||||
private Document doc1 = new Document();
|
private Document doc1 = new Document();
|
||||||
private SegmentReader reader1 = null;
|
private SegmentReader reader1 = null;
|
||||||
//Second Segment to be merged
|
//Second Segment to be merged
|
||||||
private Directory merge2Dir = new RAMDirectory();
|
private Directory merge2Dir = new MockRAMDirectory();
|
||||||
private Document doc2 = new Document();
|
private Document doc2 = new Document();
|
||||||
private SegmentReader reader2 = null;
|
private SegmentReader reader2 = null;
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,10 @@ import org.apache.lucene.util.BytesRef;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Fieldable;
|
import org.apache.lucene.document.Fieldable;
|
||||||
import org.apache.lucene.search.Similarity;
|
import org.apache.lucene.search.Similarity;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
public class TestSegmentReader extends LuceneTestCase {
|
public class TestSegmentReader extends LuceneTestCase {
|
||||||
private RAMDirectory dir = new RAMDirectory();
|
private MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
private Document testDoc = new Document();
|
private Document testDoc = new Document();
|
||||||
private SegmentReader reader = null;
|
private SegmentReader reader = null;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.index;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
|
@ -30,7 +30,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
public class TestSegmentTermDocs extends LuceneTestCase {
|
public class TestSegmentTermDocs extends LuceneTestCase {
|
||||||
private Document testDoc = new Document();
|
private Document testDoc = new Document();
|
||||||
private Directory dir = new RAMDirectory();
|
private Directory dir = new MockRAMDirectory();
|
||||||
private SegmentInfo info;
|
private SegmentInfo info;
|
||||||
|
|
||||||
public TestSegmentTermDocs(String s) {
|
public TestSegmentTermDocs(String s) {
|
||||||
|
@ -103,7 +103,7 @@ public class TestSegmentTermDocs extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSkipTo(int indexDivisor) throws IOException {
|
public void testSkipTo(int indexDivisor) throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(newRandom(), TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(newRandom(), TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
|
||||||
Term ta = new Term("content","aaa");
|
Term ta = new Term("content","aaa");
|
||||||
|
|
|
@ -28,13 +28,13 @@ import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
|
|
||||||
public class TestSegmentTermEnum extends LuceneTestCase {
|
public class TestSegmentTermEnum extends LuceneTestCase {
|
||||||
|
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
public void testTermEnum() throws IOException {
|
public void testTermEnum() throws IOException {
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class TestTermdocPerf extends LuceneTestCase {
|
||||||
|
|
||||||
|
|
||||||
public int doTest(int iter, int ndocs, int maxTF, float percentDocs) throws IOException {
|
public int doTest(int iter, int ndocs, int maxTF, float percentDocs) throws IOException {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
addDocs(dir, ndocs, "foo", "val", maxTF, percentDocs);
|
addDocs(dir, ndocs, "foo", "val", maxTF, percentDocs);
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.ScoreDoc;
|
import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.search.BooleanClause.Occur;
|
import org.apache.lucene.search.BooleanClause.Occur;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -283,7 +283,7 @@ public class TestMultiFieldQueryParser extends LuceneTestCase {
|
||||||
|
|
||||||
public void testStopWordSearching() throws Exception {
|
public void testStopWordSearching() throws Exception {
|
||||||
Analyzer analyzer = new MockAnalyzer();
|
Analyzer analyzer = new MockAnalyzer();
|
||||||
Directory ramDir = new RAMDirectory();
|
Directory ramDir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
|
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(new Field("body", "blah the footest blah", Field.Store.NO, Field.Index.ANALYZED));
|
doc.add(new Field("body", "blah the footest blah", Field.Store.NO, Field.Index.ANALYZED));
|
||||||
|
|
|
@ -58,7 +58,7 @@ import org.apache.lucene.search.TermRangeQuery;
|
||||||
import org.apache.lucene.search.ScoreDoc;
|
import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.search.WildcardQuery;
|
import org.apache.lucene.search.WildcardQuery;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LocalizedTestCase;
|
import org.apache.lucene.util.LocalizedTestCase;
|
||||||
|
@ -570,7 +570,7 @@ public class TestQueryParser extends LocalizedTestCase {
|
||||||
|
|
||||||
public void testFarsiRangeCollating() throws Exception {
|
public void testFarsiRangeCollating() throws Exception {
|
||||||
|
|
||||||
RAMDirectory ramDir = new RAMDirectory();
|
MockRAMDirectory ramDir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(new Field("content","\u0633\u0627\u0628",
|
doc.add(new Field("content","\u0633\u0627\u0628",
|
||||||
|
@ -978,7 +978,7 @@ public class TestQueryParser extends LocalizedTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLocalDateFormat() throws IOException, ParseException {
|
public void testLocalDateFormat() throws IOException, ParseException {
|
||||||
RAMDirectory ramDir = new RAMDirectory();
|
MockRAMDirectory ramDir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
||||||
addDateDoc("a", 2005, 12, 2, 10, 15, 33, iw);
|
addDateDoc("a", 2005, 12, 2, 10, 15, 33, iw);
|
||||||
addDateDoc("b", 2005, 12, 4, 22, 15, 00, iw);
|
addDateDoc("b", 2005, 12, 4, 22, 15, 00, iw);
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
public class BaseTestRangeFilter extends LuceneTestCase {
|
public class BaseTestRangeFilter extends LuceneTestCase {
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class BaseTestRangeFilter extends LuceneTestCase {
|
||||||
int maxR;
|
int maxR;
|
||||||
int minR;
|
int minR;
|
||||||
boolean allowNegativeRandomInts;
|
boolean allowNegativeRandomInts;
|
||||||
RAMDirectory index = new RAMDirectory();
|
MockRAMDirectory index = new MockRAMDirectory();
|
||||||
|
|
||||||
TestIndex(int minR, int maxR, boolean allowNegativeRandomInts) {
|
TestIndex(int minR, int maxR, boolean allowNegativeRandomInts) {
|
||||||
this.minR = minR;
|
this.minR = minR;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.IndexWriterConfig;
|
import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.index.MultiReader;
|
import org.apache.lucene.index.MultiReader;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import static org.apache.lucene.util.LuceneTestCaseJ4.TEST_VERSION_CURRENT;
|
import static org.apache.lucene.util.LuceneTestCaseJ4.TEST_VERSION_CURRENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,9 +197,9 @@ public class QueryUtils {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RAMDirectory makeEmptyIndex(final int numDeletedDocs)
|
private static MockRAMDirectory makeEmptyIndex(final int numDeletedDocs)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
RAMDirectory d = new RAMDirectory();
|
MockRAMDirectory d = new MockRAMDirectory();
|
||||||
IndexWriter w = new IndexWriter(d, new IndexWriterConfig(
|
IndexWriter w = new IndexWriter(d, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
for (int i = 0; i < numDeletedDocs; i++) {
|
for (int i = 0; i < numDeletedDocs; i++) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.index.TermsEnum;
|
import org.apache.lucene.index.TermsEnum;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.automaton.Automaton;
|
import org.apache.lucene.util.automaton.Automaton;
|
||||||
import org.apache.lucene.util.automaton.BasicAutomata;
|
import org.apache.lucene.util.automaton.BasicAutomata;
|
||||||
|
@ -43,7 +43,7 @@ public class TestAutomatonQuery extends LuceneTestCase {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
Field titleField = new Field("title", "some title", Field.Store.NO,
|
Field titleField = new Field("title", "some title", Field.Store.NO,
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.automaton.Automaton;
|
import org.apache.lucene.util.automaton.Automaton;
|
||||||
import org.apache.lucene.util.automaton.RegExp;
|
import org.apache.lucene.util.automaton.RegExp;
|
||||||
|
@ -46,7 +46,7 @@ public class TestAutomatonQueryUnicode extends LuceneTestCase {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
Field titleField = new Field("title", "some title", Field.Store.NO,
|
Field titleField = new Field("title", "some title", Field.Store.NO,
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.queryParser.ParseException;
|
import org.apache.lucene.queryParser.ParseException;
|
||||||
import org.apache.lucene.queryParser.QueryParser;
|
import org.apache.lucene.queryParser.QueryParser;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
@ -53,7 +53,7 @@ public class TestBoolean2 extends LuceneTestCase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
rnd = newRandom();
|
rnd = newRandom();
|
||||||
RAMDirectory directory = new RAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer= new RandomIndexWriter(rnd, directory);
|
RandomIndexWriter writer= new RandomIndexWriter(rnd, directory);
|
||||||
for (int i = 0; i < docFields.length; i++) {
|
for (int i = 0; i < docFields.length; i++) {
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
@ -70,7 +70,7 @@ public class TestBoolean2 extends LuceneTestCase {
|
||||||
mulFactor = 1;
|
mulFactor = 1;
|
||||||
int docCount = 0;
|
int docCount = 0;
|
||||||
do {
|
do {
|
||||||
final Directory copy = new RAMDirectory(dir2);
|
final Directory copy = new MockRAMDirectory(dir2);
|
||||||
RandomIndexWriter w = new RandomIndexWriter(rnd, dir2);
|
RandomIndexWriter w = new RandomIndexWriter(rnd, dir2);
|
||||||
w.addIndexes(new Directory[] {copy});
|
w.addIndexes(new Directory[] {copy});
|
||||||
docCount = w.maxDoc();
|
docCount = w.maxDoc();
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -55,7 +55,7 @@ public class TestBooleanMinShouldMatch extends LuceneTestCase {
|
||||||
"X 4 5 6"
|
"X 4 5 6"
|
||||||
};
|
};
|
||||||
|
|
||||||
index = new RAMDirectory();
|
index = new MockRAMDirectory();
|
||||||
RandomIndexWriter w = new RandomIndexWriter(rnd, index);
|
RandomIndexWriter w = new RandomIndexWriter(rnd, index);
|
||||||
|
|
||||||
for (int i = 0; i < data.length; i++) {
|
for (int i = 0; i < data.length; i++) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.lucene.search.IndexSearcher;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
public class TestBooleanOr extends LuceneTestCase {
|
public class TestBooleanOr extends LuceneTestCase {
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ public class TestBooleanOr extends LuceneTestCase {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
//
|
//
|
||||||
dir = new RAMDirectory();
|
dir = new MockRAMDirectory();
|
||||||
|
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
//
|
//
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
import junit.textui.TestRunner;
|
import junit.textui.TestRunner;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
|
@ -65,7 +65,7 @@ public class TestBooleanPrefixQuery extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMethod() throws Exception {
|
public void testMethod() throws Exception {
|
||||||
RAMDirectory directory = new RAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
|
|
||||||
String[] categories = new String[]{"food",
|
String[] categories = new String[]{"food",
|
||||||
"foodanddrink",
|
"foodanddrink",
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public class TestBooleanScorer extends LuceneTestCase
|
||||||
private static final String FIELD = "category";
|
private static final String FIELD = "category";
|
||||||
|
|
||||||
public void testMethod() throws Exception {
|
public void testMethod() throws Exception {
|
||||||
RAMDirectory directory = new RAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
|
|
||||||
String[] values = new String[] { "1", "2", "3", "4" };
|
String[] values = new String[] { "1", "2", "3", "4" };
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.OpenBitSet;
|
import org.apache.lucene.util.OpenBitSet;
|
||||||
|
@ -35,7 +35,7 @@ import org.apache.lucene.util.OpenBitSetDISI;
|
||||||
|
|
||||||
public class TestCachingWrapperFilter extends LuceneTestCase {
|
public class TestCachingWrapperFilter extends LuceneTestCase {
|
||||||
public void testCachingWorks() throws Exception {
|
public void testCachingWorks() throws Exception {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -61,7 +61,7 @@ public class TestCachingWrapperFilter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNullDocIdSet() throws Exception {
|
public void testNullDocIdSet() throws Exception {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -83,7 +83,7 @@ public class TestCachingWrapperFilter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNullDocIdSetIterator() throws Exception {
|
public void testNullDocIdSetIterator() throws Exception {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -124,7 +124,7 @@ public class TestCachingWrapperFilter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIsCacheAble() throws Exception {
|
public void testIsCacheAble() throws Exception {
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/** Unit test for sorting code. */
|
/** Unit test for sorting code. */
|
||||||
|
@ -50,7 +50,7 @@ public class TestCustomSearcherSort extends LuceneTestCase implements Serializab
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
Random rand = newRandom();
|
Random rand = newRandom();
|
||||||
index = new RAMDirectory();
|
index = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(rand, index);
|
RandomIndexWriter writer = new RandomIndexWriter(rand, index);
|
||||||
RandomGen random = new RandomGen(rand);
|
RandomGen random = new RandomGen(rand);
|
||||||
for (int i = 0; i < INDEX_SIZE; ++i) { // don't decrease; if to low the
|
for (int i = 0; i < INDEX_SIZE; ++i) { // don't decrease; if to low the
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class TestDateFilter extends LuceneTestCase {
|
||||||
*/
|
*/
|
||||||
public void testBefore() throws IOException {
|
public void testBefore() throws IOException {
|
||||||
// create an index
|
// create an index
|
||||||
RAMDirectory indexStore = new RAMDirectory();
|
MockRAMDirectory indexStore = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), indexStore);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), indexStore);
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
@ -110,7 +110,7 @@ public class TestDateFilter extends LuceneTestCase {
|
||||||
*/
|
*/
|
||||||
public void testAfter() throws IOException {
|
public void testAfter() throws IOException {
|
||||||
// create an index
|
// create an index
|
||||||
RAMDirectory indexStore = new RAMDirectory();
|
MockRAMDirectory indexStore = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), indexStore);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), indexStore);
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.Sort;
|
import org.apache.lucene.search.Sort;
|
||||||
import org.apache.lucene.search.SortField;
|
import org.apache.lucene.search.SortField;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test date sorting, i.e. auto-sorting of fields with type "long".
|
* Test date sorting, i.e. auto-sorting of fields with type "long".
|
||||||
|
@ -51,7 +51,7 @@ public class TestDateSort extends LuceneTestCase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
// Create an index writer.
|
// Create an index writer.
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
||||||
|
|
||||||
// oldest doc:
|
// oldest doc:
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -79,7 +79,7 @@ public class TestDisjunctionMaxQuery extends LuceneTestCase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
index = new RAMDirectory();
|
index = new MockRAMDirectory();
|
||||||
Random random = newRandom();
|
Random random = newRandom();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, index,
|
RandomIndexWriter writer = new RandomIndexWriter(random, index,
|
||||||
newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer())
|
newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.document.*;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
/** Document boost unit test.
|
/** Document boost unit test.
|
||||||
*
|
*
|
||||||
|
@ -37,7 +37,7 @@ public class TestDocBoost extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDocBoost() throws Exception {
|
public void testDocBoost() throws Exception {
|
||||||
RAMDirectory store = new RAMDirectory();
|
MockRAMDirectory store = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), store);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), store);
|
||||||
|
|
||||||
Fieldable f1 = new Field("field", "word", Field.Store.YES, Field.Index.ANALYZED);
|
Fieldable f1 = new Field("field", "word", Field.Store.YES, Field.Index.ANALYZED);
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.lucene.document.Field.Store;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class TestDocIdSet extends LuceneTestCase {
|
public class TestDocIdSet extends LuceneTestCase {
|
||||||
|
@ -101,7 +101,7 @@ public class TestDocIdSet extends LuceneTestCase {
|
||||||
public void testNullDocIdSet() throws Exception {
|
public void testNullDocIdSet() throws Exception {
|
||||||
// Tests that if a Filter produces a null DocIdSet, which is given to
|
// Tests that if a Filter produces a null DocIdSet, which is given to
|
||||||
// IndexSearcher, everything works fine. This came up in LUCENE-1754.
|
// IndexSearcher, everything works fine. This came up in LUCENE-1754.
|
||||||
Directory dir = new RAMDirectory();
|
Directory dir = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), dir);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), dir);
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(new Field("c", "val", Store.NO, Index.NOT_ANALYZED_NO_NORMS));
|
doc.add(new Field("c", "val", Store.NO, Index.NOT_ANALYZED_NO_NORMS));
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.lucene.search.spans.SpanOrQuery;
|
||||||
import org.apache.lucene.search.spans.SpanQuery;
|
import org.apache.lucene.search.spans.SpanQuery;
|
||||||
import org.apache.lucene.search.spans.SpanTermQuery;
|
import org.apache.lucene.search.spans.SpanTermQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,7 +68,7 @@ public class TestExplanations extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer= new RandomIndexWriter(newRandom(), directory);
|
RandomIndexWriter writer= new RandomIndexWriter(newRandom(), directory);
|
||||||
for (int i = 0; i < docFields.length; i++) {
|
for (int i = 0; i < docFields.length; i++) {
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.IndexWriterConfig;
|
import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.TermsEnum;
|
import org.apache.lucene.index.TermsEnum;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
@ -48,7 +48,7 @@ public class TestFieldCache extends LuceneTestCase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
Random r = newRandom();
|
Random r = newRandom();
|
||||||
RAMDirectory directory = new RAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer= new RandomIndexWriter(r, directory);
|
RandomIndexWriter writer= new RandomIndexWriter(r, directory);
|
||||||
long theLong = Long.MAX_VALUE;
|
long theLong = Long.MAX_VALUE;
|
||||||
double theDouble = Double.MAX_VALUE;
|
double theDouble = Double.MAX_VALUE;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A basic 'positive' Unit test class for the FieldCacheRangeFilter class.
|
* A basic 'positive' Unit test class for the FieldCacheRangeFilter class.
|
||||||
|
@ -516,7 +516,7 @@ public class TestFieldCacheRangeFilter extends BaseTestRangeFilter {
|
||||||
|
|
||||||
// test using a sparse index (with deleted docs).
|
// test using a sparse index (with deleted docs).
|
||||||
public void testSparseIndex() throws IOException {
|
public void testSparseIndex() throws IOException {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
|
||||||
for (int d = -20; d <= 20; d++) {
|
for (int d = -20; d <= 20; d++) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.search.BooleanClause.Occur;
|
import org.apache.lucene.search.BooleanClause.Occur;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.DocIdBitSet;
|
import org.apache.lucene.util.DocIdBitSet;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
|
@ -40,14 +40,14 @@ public class TestFilteredQuery extends LuceneTestCase {
|
||||||
|
|
||||||
private IndexSearcher searcher;
|
private IndexSearcher searcher;
|
||||||
private IndexReader reader;
|
private IndexReader reader;
|
||||||
private RAMDirectory directory;
|
private MockRAMDirectory directory;
|
||||||
private Query query;
|
private Query query;
|
||||||
private Filter filter;
|
private Filter filter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = new RAMDirectory();
|
directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter (newRandom(), directory);
|
RandomIndexWriter writer = new RandomIndexWriter (newRandom(), directory);
|
||||||
|
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.LockObtainFailedException;
|
import org.apache.lucene.store.LockObtainFailedException;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.OpenBitSet;
|
import org.apache.lucene.util.OpenBitSet;
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class TestFilteredSearch extends LuceneTestCase {
|
||||||
|
|
||||||
public void testFilteredSearch() throws CorruptIndexException, LockObtainFailedException, IOException {
|
public void testFilteredSearch() throws CorruptIndexException, LockObtainFailedException, IOException {
|
||||||
boolean enforceSingleSegment = true;
|
boolean enforceSingleSegment = true;
|
||||||
RAMDirectory directory = new RAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
int[] filterBits = {1, 36};
|
int[] filterBits = {1, 36};
|
||||||
SimpleDocIdSetFilter filter = new SimpleDocIdSetFilter(filterBits);
|
SimpleDocIdSetFilter filter = new SimpleDocIdSetFilter(filterBits);
|
||||||
IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.queryParser.QueryParser;
|
import org.apache.lucene.queryParser.QueryParser;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,7 +40,7 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
public class TestFuzzyQuery extends LuceneTestCase {
|
public class TestFuzzyQuery extends LuceneTestCase {
|
||||||
|
|
||||||
public void testFuzziness() throws Exception {
|
public void testFuzziness() throws Exception {
|
||||||
RAMDirectory directory = new RAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
||||||
addDoc("aaaaa", writer);
|
addDoc("aaaaa", writer);
|
||||||
addDoc("aaaab", writer);
|
addDoc("aaaab", writer);
|
||||||
|
@ -193,7 +193,7 @@ public class TestFuzzyQuery extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFuzzinessLong() throws Exception {
|
public void testFuzzinessLong() throws Exception {
|
||||||
RAMDirectory directory = new RAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
||||||
addDoc("aaaaaaa", writer);
|
addDoc("aaaaaaa", writer);
|
||||||
addDoc("segment", writer);
|
addDoc("segment", writer);
|
||||||
|
@ -283,7 +283,7 @@ public class TestFuzzyQuery extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTokenLengthOpt() throws IOException {
|
public void testTokenLengthOpt() throws IOException {
|
||||||
RAMDirectory directory = new RAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
||||||
addDoc("12345678911", writer);
|
addDoc("12345678911", writer);
|
||||||
addDoc("segment", writer);
|
addDoc("segment", writer);
|
||||||
|
@ -320,7 +320,7 @@ public class TestFuzzyQuery extends LuceneTestCase {
|
||||||
|
|
||||||
/** Test the TopTermsBoostOnlyBooleanQueryRewrite rewrite method. */
|
/** Test the TopTermsBoostOnlyBooleanQueryRewrite rewrite method. */
|
||||||
public void testBoostOnlyRewrite() throws Exception {
|
public void testBoostOnlyRewrite() throws Exception {
|
||||||
RAMDirectory directory = new RAMDirectory();
|
MockRAMDirectory directory = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), directory);
|
||||||
addDoc("Lucene", writer);
|
addDoc("Lucene", writer);
|
||||||
addDoc("Lucene", writer);
|
addDoc("Lucene", writer);
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,7 +86,7 @@ public class TestFuzzyQuery2 extends LuceneTestCase {
|
||||||
int bits = Integer.parseInt(reader.readLine());
|
int bits = Integer.parseInt(reader.readLine());
|
||||||
int terms = (int) Math.pow(2, bits);
|
int terms = (int) Math.pow(2, bits);
|
||||||
|
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, dir, new MockAnalyzer(MockTokenizer.KEYWORD, false));
|
RandomIndexWriter writer = new RandomIndexWriter(random, dir, new MockAnalyzer(MockTokenizer.KEYWORD, false));
|
||||||
|
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.queryParser.QueryParser;
|
import org.apache.lucene.queryParser.QueryParser;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class TestMatchAllDocsQuery extends LuceneTestCase {
|
||||||
|
|
||||||
public void testQuery() throws Exception {
|
public void testQuery() throws Exception {
|
||||||
|
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(
|
IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(
|
||||||
TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(2));
|
TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(2));
|
||||||
addDoc("one", iw, 1f);
|
addDoc("one", iw, 1f);
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.queryParser.QueryParser;
|
import org.apache.lucene.queryParser.QueryParser;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import org.apache.lucene.store.MockRAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -235,11 +235,11 @@ public class TestMultiSearcher extends LuceneTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFieldSelector() throws Exception {
|
public void testFieldSelector() throws Exception {
|
||||||
RAMDirectory ramDirectory1, ramDirectory2;
|
MockRAMDirectory ramDirectory1, ramDirectory2;
|
||||||
IndexSearcher indexSearcher1, indexSearcher2;
|
IndexSearcher indexSearcher1, indexSearcher2;
|
||||||
|
|
||||||
ramDirectory1 = new RAMDirectory();
|
ramDirectory1 = new MockRAMDirectory();
|
||||||
ramDirectory2 = new RAMDirectory();
|
ramDirectory2 = new MockRAMDirectory();
|
||||||
Query query = new TermQuery(new Term("contents", "doc0"));
|
Query query = new TermQuery(new Term("contents", "doc0"));
|
||||||
|
|
||||||
// Now put the documents in a different index
|
// Now put the documents in a different index
|
||||||
|
@ -292,7 +292,7 @@ public class TestMultiSearcher extends LuceneTestCase
|
||||||
private void testNormalization(int nDocs, String message) throws IOException {
|
private void testNormalization(int nDocs, String message) throws IOException {
|
||||||
Query query=new TermQuery(new Term("contents", "doc0"));
|
Query query=new TermQuery(new Term("contents", "doc0"));
|
||||||
|
|
||||||
RAMDirectory ramDirectory1;
|
MockRAMDirectory ramDirectory1;
|
||||||
IndexSearcher indexSearcher1;
|
IndexSearcher indexSearcher1;
|
||||||
ScoreDoc[] hits;
|
ScoreDoc[] hits;
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ public class TestMultiSearcher extends LuceneTestCase
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RAMDirectory ramDirectory2;
|
MockRAMDirectory ramDirectory2;
|
||||||
IndexSearcher indexSearcher2;
|
IndexSearcher indexSearcher2;
|
||||||
|
|
||||||
ramDirectory1=new MockRAMDirectory();
|
ramDirectory1=new MockRAMDirectory();
|
||||||
|
@ -366,7 +366,7 @@ public class TestMultiSearcher extends LuceneTestCase
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void testCustomSimilarity () throws IOException {
|
public void testCustomSimilarity () throws IOException {
|
||||||
RAMDirectory dir = new RAMDirectory();
|
MockRAMDirectory dir = new MockRAMDirectory();
|
||||||
initIndex(dir, 10, true, "x"); // documents with two tokens "doc0" and "x", "doc1" and x, etc...
|
initIndex(dir, 10, true, "x"); // documents with two tokens "doc0" and "x", "doc1" and x, etc...
|
||||||
IndexSearcher srchr = new IndexSearcher(dir, true);
|
IndexSearcher srchr = new IndexSearcher(dir, true);
|
||||||
MultiSearcher msrchr = getMultiSearcherInstance(new Searcher[]{srchr});
|
MultiSearcher msrchr = getMultiSearcherInstance(new Searcher[]{srchr});
|
||||||
|
@ -406,8 +406,8 @@ public class TestMultiSearcher extends LuceneTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDocFreq() throws IOException{
|
public void testDocFreq() throws IOException{
|
||||||
RAMDirectory dir1 = new RAMDirectory();
|
MockRAMDirectory dir1 = new MockRAMDirectory();
|
||||||
RAMDirectory dir2 = new RAMDirectory();
|
MockRAMDirectory dir2 = new MockRAMDirectory();
|
||||||
|
|
||||||
initIndex(dir1, 10, true, "x"); // documents with two tokens "doc0" and "x", "doc1" and x, etc...
|
initIndex(dir1, 10, true, "x"); // documents with two tokens "doc0" and "x", "doc1" and x, etc...
|
||||||
initIndex(dir2, 5, true, "x"); // documents with two tokens "doc0" and "x", "doc1" and x, etc...
|
initIndex(dir2, 5, true, "x"); // documents with two tokens "doc0" and "x", "doc1" and x, etc...
|
||||||
|
@ -419,8 +419,8 @@ public class TestMultiSearcher extends LuceneTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateDocFrequencyMap() throws IOException{
|
public void testCreateDocFrequencyMap() throws IOException{
|
||||||
RAMDirectory dir1 = new RAMDirectory();
|
MockRAMDirectory dir1 = new MockRAMDirectory();
|
||||||
RAMDirectory dir2 = new RAMDirectory();
|
MockRAMDirectory dir2 = new MockRAMDirectory();
|
||||||
Term template = new Term("contents") ;
|
Term template = new Term("contents") ;
|
||||||
String[] contents = {"a", "b", "c"};
|
String[] contents = {"a", "b", "c"};
|
||||||
HashSet<Term> termsSet = new HashSet<Term>();
|
HashSet<Term> termsSet = new HashSet<Term>();
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.queryParser.ParseException;
|
import org.apache.lucene.queryParser.ParseException;
|
||||||
import org.apache.lucene.queryParser.QueryParser;
|
import org.apache.lucene.queryParser.QueryParser;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.MockRAMDirectory;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,11 +112,11 @@ public class TestMultiSearcherRanking extends LuceneTestCase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
// create MultiSearcher from two seperate searchers
|
// create MultiSearcher from two seperate searchers
|
||||||
Directory d1 = new RAMDirectory();
|
Directory d1 = new MockRAMDirectory();
|
||||||
IndexWriter iw1 = new IndexWriter(d1, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iw1 = new IndexWriter(d1, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
addCollection1(iw1);
|
addCollection1(iw1);
|
||||||
iw1.close();
|
iw1.close();
|
||||||
Directory d2 = new RAMDirectory();
|
Directory d2 = new MockRAMDirectory();
|
||||||
IndexWriter iw2 = new IndexWriter(d2, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iw2 = new IndexWriter(d2, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
addCollection2(iw2);
|
addCollection2(iw2);
|
||||||
iw2.close();
|
iw2.close();
|
||||||
|
@ -127,7 +127,7 @@ public class TestMultiSearcherRanking extends LuceneTestCase {
|
||||||
multiSearcher = new MultiSearcher(s);
|
multiSearcher = new MultiSearcher(s);
|
||||||
|
|
||||||
// create IndexSearcher which contains all documents
|
// create IndexSearcher which contains all documents
|
||||||
Directory d = new RAMDirectory();
|
Directory d = new MockRAMDirectory();
|
||||||
IndexWriter iw = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter iw = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
addCollection1(iw);
|
addCollection1(iw);
|
||||||
addCollection2(iw);
|
addCollection2(iw);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue