org.apache.lucene.index.LiveIndexWriterConfig Java Examples

The following examples show how to use org.apache.lucene.index.LiveIndexWriterConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LuceneSearchIndex.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
public void forReindexing(Runnable r) {
  final LiveIndexWriterConfig config = writer.getConfig();
  final double maxRAMBufferSizeMB = config.getRAMBufferSizeMB();
  final boolean useCompoundFile = config.getUseCompoundFile();

  try {
    reindexing = true;
    // Adjust index writer settings to be better suited for reindexing
    config.setRAMBufferSizeMB(REINDEX_RAM_BUFFER_SIZE_MB);
    config.setUseCompoundFile(false);
    r.run();
    commit();
  } catch (Exception ex) {
    throw Throwables.propagate(ex);
  } finally {
    config.setRAMBufferSizeMB(maxRAMBufferSizeMB);
    config.setUseCompoundFile(useCompoundFile);
    reindexing = false;
  }
}
 
Example #2
Source File: DLBasedEngine.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private void updateIndexWriterSettings() {
    try {
        final LiveIndexWriterConfig iwc = indexWriter.getConfig();
        iwc.setRAMBufferSizeMB(engineConfig.getIndexingBufferSize().mbFrac());
        iwc.setUseCompoundFile(engineConfig.isCompoundOnFlush());
    } catch (AlreadyClosedException ex) {
        // ignore
    }
}
 
Example #3
Source File: InternalEngine.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private void updateIndexWriterSettings() {
    try {
        final LiveIndexWriterConfig iwc = indexWriter.getConfig();
        iwc.setRAMBufferSizeMB(engineConfig.getIndexingBufferSize().mbFrac());
        iwc.setUseCompoundFile(engineConfig.isCompoundOnFlush());
    } catch (AlreadyClosedException ex) {
        // ignore
    }
}
 
Example #4
Source File: EngineTestCase.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    primaryTerm.set(randomLongBetween(1, Long.MAX_VALUE));
    CodecService codecService = new CodecService(null, logger);
    String name = Codec.getDefault().getName();
    if (Arrays.asList(codecService.availableCodecs()).contains(name)) {
        // some codecs are read only so we only take the ones that we have in the service and randomly
        // selected by lucene test case.
        codecName = name;
    } else {
        codecName = "default";
    }
    defaultSettings = IndexSettingsModule.newIndexSettings("test", indexSettings());
    threadPool = new TestThreadPool(getClass().getName());
    store = createStore();
    storeReplica = createStore();
    Lucene.cleanLuceneIndex(store.directory());
    Lucene.cleanLuceneIndex(storeReplica.directory());
    primaryTranslogDir = createTempDir("translog-primary");
    translogHandler = createTranslogHandler(defaultSettings);
    engine = createEngine(store, primaryTranslogDir);
    LiveIndexWriterConfig currentIndexWriterConfig = engine.getCurrentIndexWriterConfig();

    assertEquals(engine.config().getCodec().getName(), codecService.codec(codecName).getName());
    assertEquals(currentIndexWriterConfig.getCodec().getName(), codecService.codec(codecName).getName());
    if (randomBoolean()) {
        engine.config().setEnableGcDeletes(false);
    }
    replicaTranslogDir = createTempDir("translog-replica");
    replicaEngine = createEngine(storeReplica, replicaTranslogDir);
    currentIndexWriterConfig = replicaEngine.getCurrentIndexWriterConfig();

    assertEquals(replicaEngine.config().getCodec().getName(), codecService.codec(codecName).getName());
    assertEquals(currentIndexWriterConfig.getCodec().getName(), codecService.codec(codecName).getName());
    if (randomBoolean()) {
        engine.config().setEnableGcDeletes(false);
    }
}
 
Example #5
Source File: test.java    From vscode-extension with MIT License 4 votes vote down vote up
LiveIndexWriterConfig getCurrentIndexWriterConfig() {
    return indexWriter.getConfig();
}
 
Example #6
Source File: DLBasedEngine.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
LiveIndexWriterConfig getCurrentIndexWriterConfig() {
    return indexWriter.getConfig();
}
 
Example #7
Source File: InternalEngine.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
LiveIndexWriterConfig getCurrentIndexWriterConfig() {
    return indexWriter.getConfig();
}
 
Example #8
Source File: InternalEngine.java    From crate with Apache License 2.0 4 votes vote down vote up
LiveIndexWriterConfig getCurrentIndexWriterConfig() {
    return indexWriter.getConfig();
}
 
Example #9
Source File: TestSolrIndexConfig.java    From lucene-solr with Apache License 2.0 3 votes vote down vote up
private void checkIndexWriterConfig(LiveIndexWriterConfig iwc) {

    assertTrue(iwc.getInfoStream() instanceof LoggingInfoStream);
    assertTrue(iwc.getMergePolicy().getClass().toString(),
               iwc.getMergePolicy() instanceof RandomMergePolicy);

  }