Search in sources :

Example 6 with LiveIndexWriterConfig

use of org.apache.lucene.index.LiveIndexWriterConfig in project crate by crate.

the class InternalEngineTests method testSettings.

@Test
public void testSettings() {
    CodecService codecService = new CodecService(null, logger);
    LiveIndexWriterConfig currentIndexWriterConfig = engine.getCurrentIndexWriterConfig();
    assertEquals(engine.config().getCodec().getName(), codecService.codec(codecName).getName());
    assertEquals(currentIndexWriterConfig.getCodec().getName(), codecService.codec(codecName).getName());
}
Also used : LiveIndexWriterConfig(org.apache.lucene.index.LiveIndexWriterConfig) CodecService(org.elasticsearch.index.codec.CodecService) Test(org.junit.Test)

Example 7 with LiveIndexWriterConfig

use of org.apache.lucene.index.LiveIndexWriterConfig in project orientdb by orientechnologies.

the class OLuceneIndexWriterFactoryTest method shouldCreateIndexWriterConfiguredWithMetadataValues.

@Test
public void shouldCreateIndexWriterConfiguredWithMetadataValues() throws Exception {
    OLuceneIndexWriterFactory fc = new OLuceneIndexWriterFactory();
    // sample metadata json
    ODocument meta = new ODocument().fromJSON(OIOUtils.readFileAsString(new File("./src/test/resources/index_metadata_new.json")));
    IndexWriter writer = fc.createIndexWriter(new RAMDirectory(), meta, new StandardAnalyzer());
    LiveIndexWriterConfig config = writer.getConfig();
    assertThat(config.getUseCompoundFile()).isFalse();
    assertThat(config.getAnalyzer()).isInstanceOf(StandardAnalyzer.class);
    assertThat(config.getMaxBufferedDocs()).isEqualTo(-1);
    assertThat(config.getRAMPerThreadHardLimitMB()).isEqualTo(1024);
}
Also used : LiveIndexWriterConfig(org.apache.lucene.index.LiveIndexWriterConfig) IndexWriter(org.apache.lucene.index.IndexWriter) StandardAnalyzer(org.apache.lucene.analysis.standard.StandardAnalyzer) File(java.io.File) RAMDirectory(org.apache.lucene.store.RAMDirectory) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) Test(org.junit.Test)

Aggregations

LiveIndexWriterConfig (org.apache.lucene.index.LiveIndexWriterConfig)7 CodecService (org.elasticsearch.index.codec.CodecService)5 TestThreadPool (org.elasticsearch.threadpool.TestThreadPool)3 Before (org.junit.Before)3 Test (org.junit.Test)2 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)1 File (java.io.File)1 StandardAnalyzer (org.apache.lucene.analysis.standard.StandardAnalyzer)1 IndexWriter (org.apache.lucene.index.IndexWriter)1 RAMDirectory (org.apache.lucene.store.RAMDirectory)1 Settings (org.elasticsearch.common.settings.Settings)1 IndexService (org.elasticsearch.index.IndexService)1 IndexSettings (org.elasticsearch.index.IndexSettings)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1