當前位置: 首頁>>代碼示例>>Java>>正文


Java LiveIndexWriterConfig類代碼示例

本文整理匯總了Java中org.apache.lucene.index.LiveIndexWriterConfig的典型用法代碼示例。如果您正苦於以下問題:Java LiveIndexWriterConfig類的具體用法?Java LiveIndexWriterConfig怎麽用?Java LiveIndexWriterConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LiveIndexWriterConfig類屬於org.apache.lucene.index包,在下文中一共展示了LiveIndexWriterConfig類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSettings

import org.apache.lucene.index.LiveIndexWriterConfig; //導入依賴的package包/類
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());
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:8,代碼來源:InternalEngineTests.java

示例2: updateIndexWriterSettings

import org.apache.lucene.index.LiveIndexWriterConfig; //導入依賴的package包/類
private void updateIndexWriterSettings() {
    try {
        final LiveIndexWriterConfig iwc = indexWriter.getConfig();
        iwc.setRAMBufferSizeMB(engineConfig.getIndexingBufferSize().mbFrac());
        iwc.setUseCompoundFile(engineConfig.isCompoundOnFlush());
    } catch (AlreadyClosedException ex) {
        // ignore
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:10,代碼來源:DLBasedEngine.java

示例3: checkIndexWriterConfig

import org.apache.lucene.index.LiveIndexWriterConfig; //導入依賴的package包/類
private void checkIndexWriterConfig(LiveIndexWriterConfig iwc) {

    assertEquals(123, iwc.getMaxThreadStates());
    assertTrue(iwc.getInfoStream() instanceof PrintStreamInfoStream);
    assertTrue(iwc.getMergePolicy().getClass().toString(),
               iwc.getMergePolicy() instanceof RandomMergePolicy);

  }
 
開發者ID:europeana,項目名稱:search,代碼行數:9,代碼來源:TestSolrIndexConfig.java

示例4: getCurrentIndexWriterConfig

import org.apache.lucene.index.LiveIndexWriterConfig; //導入依賴的package包/類
LiveIndexWriterConfig getCurrentIndexWriterConfig() {
    return indexWriter.getConfig();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:4,代碼來源:InternalEngine.java

示例5: setUp

import org.apache.lucene.index.LiveIndexWriterConfig; //導入依賴的package包/類
@Override
@Before
public void setUp() throws Exception {
    super.setUp();

    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", Settings.builder()
            .put(IndexSettings.INDEX_GC_DELETES_SETTING.getKey(), "1h") // make sure this doesn't kick in on us
            .put(EngineConfig.INDEX_CODEC_SETTING.getKey(), codecName)
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put(IndexSettings.MAX_REFRESH_LISTENERS_PER_SHARD.getKey(),
                    between(10, 10 * IndexSettings.MAX_REFRESH_LISTENERS_PER_SHARD.get(Settings.EMPTY)))
            .build()); // TODO randomize more settings
    threadPool = new TestThreadPool(getClass().getName());
    store = createStore();
    storeReplica = createStore();
    Lucene.cleanLuceneIndex(store.directory());
    Lucene.cleanLuceneIndex(storeReplica.directory());
    primaryTranslogDir = createTempDir("translog-primary");
    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);
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:46,代碼來源:InternalEngineTests.java

示例6: setUp

import org.apache.lucene.index.LiveIndexWriterConfig; //導入依賴的package包/類
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    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", Settings.builder()
            .put(IndexSettings.INDEX_GC_DELETES_SETTING, "1h") // make sure this doesn't kick in on us
            .put(EngineConfig.INDEX_CODEC_SETTING.getKey(), codecName)
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .build()); // TODO randomize more settings

    threadPool = new TestThreadPool(getClass().getName());
    dirPath = createTempDir();
    store = createStore(dirPath);
    storeReplica = createStore(dirPath);
    Lucene.cleanLuceneIndex(store.directory());
    Lucene.cleanLuceneIndex(storeReplica.directory());
    primaryEngine = createInternalEngine(store, createTempDir("translog-primary"));
    LiveIndexWriterConfig currentIndexWriterConfig = ((InternalEngine)primaryEngine).getCurrentIndexWriterConfig();

    assertEquals(primaryEngine.config().getCodec().getName(), codecService.codec(codecName).getName());
    assertEquals(currentIndexWriterConfig.getCodec().getName(), codecService.codec(codecName).getName());
    if (randomBoolean()) {
        primaryEngine.config().setEnableGcDeletes(false);
    }

    replicaEngine = createShadowEngine(storeReplica);

    assertEquals(replicaEngine.config().getCodec().getName(), codecService.codec(codecName).getName());
    if (randomBoolean()) {
        replicaEngine.config().setEnableGcDeletes(false);
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:42,代碼來源:ShadowEngineTests.java

示例7: testSettingsUpdate

import org.apache.lucene.index.LiveIndexWriterConfig; //導入依賴的package包/類
public void testSettingsUpdate() {
    final IndexService service = createIndex("foo");
    InternalEngine engine = ((InternalEngine) EngineAccess.engine(service.getShardOrNull(0)));
    assertThat(engine.getCurrentIndexWriterConfig().getUseCompoundFile(), is(true));
    final int iters = between(1, 20);
    for (int i = 0; i < iters; i++) {

        // Tricky: TimeValue.parseTimeValue casts this long to a double, which steals 11 of the 64 bits for exponent, so we can't use
        // the full long range here else the assert below fails:
        long gcDeletes = random().nextLong() & (Long.MAX_VALUE >> 11);

        Settings build = Settings.builder()
                .put(IndexSettings.INDEX_GC_DELETES_SETTING.getKey(), gcDeletes, TimeUnit.MILLISECONDS)
                .build();
        assertEquals(gcDeletes, build.getAsTime(IndexSettings.INDEX_GC_DELETES_SETTING.getKey(), null).millis());

        client().admin().indices().prepareUpdateSettings("foo").setSettings(build).get();
        LiveIndexWriterConfig currentIndexWriterConfig = engine.getCurrentIndexWriterConfig();
        assertEquals(currentIndexWriterConfig.getUseCompoundFile(), true);


        assertEquals(engine.config().getIndexSettings().getGcDeletesInMillis(), gcDeletes);
        assertEquals(engine.getGcDeletesInMillis(), gcDeletes);

    }

    Settings settings = Settings.builder()
            .put(IndexSettings.INDEX_GC_DELETES_SETTING.getKey(), 1000, TimeUnit.MILLISECONDS)
            .build();
    client().admin().indices().prepareUpdateSettings("foo").setSettings(settings).get();
    assertEquals(engine.getGcDeletesInMillis(), 1000);
    assertTrue(engine.config().isEnableGcDeletes());


    settings = Settings.builder()
            .put(IndexSettings.INDEX_GC_DELETES_SETTING.getKey(), "0ms")
            .build();

    client().admin().indices().prepareUpdateSettings("foo").setSettings(settings).get();
    assertEquals(engine.getGcDeletesInMillis(), 0);
    assertTrue(engine.config().isEnableGcDeletes());

    settings = Settings.builder()
            .put(IndexSettings.INDEX_GC_DELETES_SETTING.getKey(), 1000, TimeUnit.MILLISECONDS)
            .build();
    client().admin().indices().prepareUpdateSettings("foo").setSettings(settings).get();
    assertEquals(engine.getGcDeletesInMillis(), 1000);
    assertTrue(engine.config().isEnableGcDeletes());
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:50,代碼來源:InternalEngineSettingsTests.java


注:本文中的org.apache.lucene.index.LiveIndexWriterConfig類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。