Example usage for org.apache.lucene.analysis MockAnalyzer MockAnalyzer

List of usage examples for org.apache.lucene.analysis MockAnalyzer MockAnalyzer

Introduction

In this page you can find the example usage for org.apache.lucene.analysis MockAnalyzer MockAnalyzer.

Prototype

MockAnalyzer

Source Link

Usage

From source file:edu.illinois.enforcemop.examples.lucene.TestLockFactory.java

License:Apache License

public void _testStressLocks(String scheduleName, LockFactory lockFactory, File indexDir) throws Exception {
    Directory dir = newFSDirectory(indexDir, lockFactory);

    // First create a 1 doc index:
    IndexWriter w = new IndexWriter(dir,
            new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setOpenMode(OpenMode.CREATE));
    addDoc(w);/* w  w w.java  2 s  .  c  o m*/
    w.close();

    WriterThread writer = new WriterThread(100, dir);
    writer.setName("writerThread");
    SearcherThread searcher = new SearcherThread(100, dir);
    searcher.setName("searcherThread");
    writer.start();
    searcher.start();

    //        while(writer.isAlive() || searcher.isAlive()) {
    //              Thread.sleep(5000);
    //}

    Thread.sleep(5000);
    assertTrue("IndexWriter hit unexpected exceptions", !writer.hitException);
    assertTrue("IndexSearcher hit unexpected exceptions", !searcher.hitException);

    dir.close();
    // Cleanup
    searcher.join();
    writer.join();
    _TestUtil.rmDir(indexDir);
}

From source file:edu.illinois.imunit.examples.lucene.TestLockFactory.java

License:Apache License

public void _testStressLocks(String scheduleName, LockFactory lockFactory, File indexDir) throws Exception {
    Directory dir = newFSDirectory(indexDir, lockFactory);

    // First create a 1 doc index:
    IndexWriter w = new IndexWriter(dir,
            new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setOpenMode(OpenMode.CREATE));
    addDoc(w);/*from  w  ww  . jav  a 2 s  .c o m*/
    w.close();

    WriterThread writer = new WriterThread(100, dir);
    writer.setName("writerThread");
    SearcherThread searcher = new SearcherThread(100, dir);
    searcher.setName("searcherThread");
    writer.start();
    searcher.start();

    //        while(writer.isAlive() || searcher.isAlive()) {
    //              Thread.sleep(5000);
    //}

    fireEvent("beforeCheck");
    assertTrue("IndexWriter hit unexpected exceptions", !writer.hitException);
    assertTrue("IndexSearcher hit unexpected exceptions", !searcher.hitException);

    dir.close();
    // Cleanup
    searcher.join();
    writer.join();
    _TestUtil.rmDir(indexDir);
}