Example usage for org.apache.lucene.index IndexWriterConfig DEFAULT_RAM_BUFFER_SIZE_MB

List of usage examples for org.apache.lucene.index IndexWriterConfig DEFAULT_RAM_BUFFER_SIZE_MB

Introduction

In this page you can find the example usage for org.apache.lucene.index IndexWriterConfig DEFAULT_RAM_BUFFER_SIZE_MB.

Prototype

double DEFAULT_RAM_BUFFER_SIZE_MB

To view the source code for org.apache.lucene.index IndexWriterConfig DEFAULT_RAM_BUFFER_SIZE_MB.

Click Source Link

Document

Default value is 16 MB (which means flush when buffered docs consume approximately 16 MB RAM).

Usage

From source file:com.github.rnewson.couchdb.lucene.DatabaseIndexer.java

License:Apache License

private IndexWriter newWriter(final Directory dir) throws IOException {
    final IndexWriterConfig config = new IndexWriterConfig(Constants.VERSION, Constants.ANALYZER);
    config.setUseCompoundFile(ini.getBoolean("lucene.useCompoundFile", false));
    config.setRAMBufferSizeMB(/*  w  w w . j  ava 2s .c  om*/
            ini.getDouble("lucene.ramBufferSizeMB", IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB));

    return new IndexWriter(dir, config);
}

From source file:com.google.gerrit.lucene.GerritIndexWriterConfig.java

License:Apache License

GerritIndexWriterConfig(Config cfg, String name) {
    analyzer = new CustomMappingAnalyzer(new StandardAnalyzer(CharArraySet.EMPTY_SET), CUSTOM_CHAR_MAPPING);
    luceneConfig = new IndexWriterConfig(analyzer).setOpenMode(OpenMode.CREATE_OR_APPEND)
            .setCommitOnClose(true);//from  w  ww . j a  va 2  s .c  om
    double m = 1 << 20;
    luceneConfig.setRAMBufferSizeMB(cfg.getLong("index", name, "ramBufferSize",
            (long) (IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB * m)) / m);
    luceneConfig.setMaxBufferedDocs(
            cfg.getInt("index", name, "maxBufferedDocs", IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS));
    try {
        commitWithinMs = ConfigUtil.getTimeUnit(cfg, "index", name, "commitWithin",
                MILLISECONDS.convert(5, MINUTES), MILLISECONDS);
    } catch (IllegalArgumentException e) {
        commitWithinMs = cfg.getLong("index", name, "commitWithin", 0);
    }
}

From source file:dk.defxws.fedoragsearch.server.Config.java

License:Open Source License

public double getRamBufferSize(String indexName) {
    double ramBufferSize = IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB;

    try {/*from   w ww.  j a  v a  2s  .c  o  m*/
        ramBufferSize = Double.parseDouble(getIndexProps(indexName).getProperty("fgsindex.ramBufferSize"));
    } catch (NumberFormatException e) {
    } catch (NullPointerException e) {
    }
    return ramBufferSize;
}

From source file:org.apache.solr.core.TestMergePolicyConfig.java

License:Apache License

public void testLogMergePolicyConfig() throws Exception {

    final Class<? extends LogMergePolicy> mpClass = random().nextBoolean() ? LogByteSizeMergePolicy.class
            : LogDocMergePolicy.class;

    System.setProperty("solr.test.log.merge.policy", mpClass.getName());

    initCore("solrconfig-logmergepolicy.xml", "schema-minimal.xml");
    IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getLatestSchema());

    // verify some props set to -1 get lucene internal defaults
    assertEquals(-1, solrConfig.indexConfig.maxBufferedDocs);
    assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, iwc.getMaxBufferedDocs());
    assertEquals(-1, solrConfig.indexConfig.maxIndexingThreads);
    assertEquals(IndexWriterConfig.DEFAULT_MAX_THREAD_STATES, iwc.getMaxThreadStates());
    assertEquals(-1, solrConfig.indexConfig.ramBufferSizeMB, 0.0D);
    assertEquals(IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB, iwc.getRAMBufferSizeMB(), 0.0D);

    LogMergePolicy logMP = assertAndCast(mpClass, iwc.getMergePolicy());

    // set by legacy <mergeFactor> setting
    assertEquals(11, logMP.getMergeFactor());
    // set by legacy <maxMergeDocs> setting
    assertEquals(456, logMP.getMaxMergeDocs());

}

From source file:vtk.repository.index.IndexManager.java

private IndexWriterConfig newIndexWriterConfig() {
    IndexWriterConfig cfg = new IndexWriterConfig(Version.LATEST, new KeywordAnalyzer());
    cfg.setMaxThreadStates(1); // We have only at most one writing thread.

    // XXX switch to LogByteSizeMergePolicy if problems with (default) TieredMergePolicy arise.
    //        LogByteSizeMergePolicy mp = new LogByteSizeMergePolicy();
    //        mp.setMergeFactor(this.batchIndexingMode ? 25: 5);
    //        cfg.setMergePolicy(mp);

    cfg.setRAMBufferSizeMB(batchIndexingMode ? 32.0 : IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB);
    return cfg;// ww w .  j  a va 2  s .c  om
}