Example usage for org.apache.lucene.index LiveIndexWriterConfig getOpenMode

List of usage examples for org.apache.lucene.index LiveIndexWriterConfig getOpenMode

Introduction

In this page you can find the example usage for org.apache.lucene.index LiveIndexWriterConfig getOpenMode.

Prototype

public OpenMode getOpenMode() 

Source Link

Document

Returns the OpenMode set by IndexWriterConfig#setOpenMode(OpenMode) .

Usage

From source file:net.riezebos.thoth.content.search.util.TestIndexer.java

License:Apache License

@Override
protected IndexWriter getWriter(boolean wipeIndex) throws IOException {
    LiveIndexWriterConfig config = mock(LiveIndexWriterConfig.class);
    when(config.getOpenMode()).thenReturn(wipeIndex ? OpenMode.CREATE : OpenMode.CREATE_OR_APPEND);

    IndexWriter indexWriter = mock(IndexWriter.class);
    when(indexWriter.getConfig()).thenReturn(config);
    recordAddDocument(indexWriter);/*from w w w  .java 2 s .c o m*/
    recordUpdateDocument(indexWriter);

    return indexWriter;
}