当前位置: 首页>>代码示例>>Java>>正文


Java Settings.getAsBoolean方法代码示例

本文整理汇总了Java中org.elasticsearch.common.settings.Settings.getAsBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java Settings.getAsBoolean方法的具体用法?Java Settings.getAsBoolean怎么用?Java Settings.getAsBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.settings.Settings的用法示例。


在下文中一共展示了Settings.getAsBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: KeepWordFilterFactory

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public KeepWordFilterFactory(Index index, IndexSettingsService indexSettingsService,
                             Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);

    final String[] arrayKeepWords = settings.getAsArray(KEEP_WORDS_KEY, null);
    final String keepWordsPath = settings.get(KEEP_WORDS_PATH_KEY, null);
    if ((arrayKeepWords == null && keepWordsPath == null) || (arrayKeepWords != null && keepWordsPath != null)) {
        // we don't allow both or none
        throw new IllegalArgumentException("keep requires either `" + KEEP_WORDS_KEY + "` or `"
                + KEEP_WORDS_PATH_KEY + "` to be configured");
    }
    if (version.onOrAfter(Version.LUCENE_4_4) && settings.get(ENABLE_POS_INC_KEY) != null) {
        throw new IllegalArgumentException(ENABLE_POS_INC_KEY + " is not supported anymore. Please fix your analysis chain or use"
                + " an older compatibility version (<=4.3) but beware that it might cause highlighting bugs.");
    }
    enablePositionIncrements = version.onOrAfter(Version.LUCENE_4_4) ? true : settings.getAsBoolean(ENABLE_POS_INC_KEY, true);

    this.keepWords = Analysis.getWordSet(env, settings, KEEP_WORDS_KEY);

}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:22,代码来源:KeepWordFilterFactory.java

示例2: HunspellTokenFilterFactory

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public HunspellTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings, HunspellService hunspellService)  {
    super(index, indexSettingsService.getSettings(), name, settings);

    String locale = settings.get("locale", settings.get("language", settings.get("lang", null)));
    if (locale == null) {
        throw new IllegalArgumentException("missing [locale | language | lang] configuration for hunspell token filter");
    }

    dictionary = hunspellService.getDictionary(locale);
    if (dictionary == null) {
        throw new IllegalArgumentException(String.format(Locale.ROOT, "Unknown hunspell dictionary for locale [%s]", locale));
    }

    dedup = settings.getAsBoolean("dedup", true);
    longestOnly = settings.getAsBoolean("longest_only", false);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:18,代码来源:HunspellTokenFilterFactory.java

示例3: IndexQueryParserService

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public IndexQueryParserService(Index index, IndexSettingsService indexSettingsService,
                               IndicesQueriesRegistry indicesQueriesRegistry,
                               ScriptService scriptService, AnalysisService analysisService,
                               MapperService mapperService, IndexCache indexCache, IndexFieldDataService fieldDataService,
                               BitsetFilterCache bitsetFilterCache,
                               @Nullable SimilarityService similarityService) {
    super(index, indexSettingsService.getSettings());
    this.indexSettingsService = indexSettingsService;
    this.scriptService = scriptService;
    this.analysisService = analysisService;
    this.mapperService = mapperService;
    this.similarityService = similarityService;
    this.indexCache = indexCache;
    this.fieldDataService = fieldDataService;
    this.bitsetFilterCache = bitsetFilterCache;

    Settings indexSettings = indexSettingsService.getSettings();
    this.defaultField = indexSettings.get(DEFAULT_FIELD, AllFieldMapper.NAME);
    this.queryStringLenient = indexSettings.getAsBoolean(QUERY_STRING_LENIENT, false);
    this.parseFieldMatcher = new ParseFieldMatcher(indexSettings);
    this.defaultAllowUnmappedFields = indexSettings.getAsBoolean(ALLOW_UNMAPPED, true);
    this.indicesQueriesRegistry = indicesQueriesRegistry;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:25,代码来源:IndexQueryParserService.java

示例4: AutoCreateIndex

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public AutoCreateIndex(Settings settings, IndexNameExpressionResolver resolver) {
    this.resolver = resolver;
    dynamicMappingDisabled = !settings.getAsBoolean(MapperService.INDEX_MAPPER_DYNAMIC_SETTING, MapperService.INDEX_MAPPER_DYNAMIC_DEFAULT);
    String value = settings.get("action.auto_create_index");
    if (value == null || Booleans.isExplicitTrue(value)) {
        needToCheck = true;
        globallyDisabled = false;
        matches = null;
        matches2 = null;
    } else if (Booleans.isExplicitFalse(value)) {
        needToCheck = false;
        globallyDisabled = true;
        matches = null;
        matches2 = null;
    } else {
        needToCheck = true;
        globallyDisabled = false;
        matches = Strings.commaDelimitedListToStringArray(value);
        matches2 = new String[matches.length];
        for (int i = 0; i < matches.length; i++) {
            matches2[i] = matches[i].substring(1);
        }
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:26,代码来源:AutoCreateIndex.java

示例5: PercolatorQueriesRegistry

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
public PercolatorQueriesRegistry(ShardId shardId, Settings indexSettings, IndexQueryParserService queryParserService,
                                 ShardIndexingService indexingService, IndicesLifecycle indicesLifecycle, MapperService mapperService,
                                 IndexFieldDataService indexFieldDataService, ShardPercolateService shardPercolateService) {
    super(shardId, indexSettings);
    this.queryParserService = queryParserService;
    this.mapperService = mapperService;
    this.indicesLifecycle = indicesLifecycle;
    this.indexingService = indexingService;
    this.indexFieldDataService = indexFieldDataService;
    this.shardPercolateService = shardPercolateService;
    this.mapUnmappedFieldsAsString = indexSettings.getAsBoolean(MAP_UNMAPPED_FIELDS_AS_STRING, false);

    indicesLifecycle.addListener(shardLifecycleListener);
    mapperService.addTypeListener(percolateTypeListener);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:16,代码来源:PercolatorQueriesRegistry.java

示例6: PatternReplaceTokenFilterFactory

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public PatternReplaceTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);

    String sPattern = settings.get("pattern", null);
    if (sPattern == null) {
        throw new IllegalArgumentException("pattern is missing for [" + name + "] token filter of type 'pattern_replace'");
    }
    this.pattern = Regex.compile(sPattern, settings.get("flags"));
    this.replacement = settings.get("replacement", "");
    this.all = settings.getAsBoolean("all", true);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:PatternReplaceTokenFilterFactory.java

示例7: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {
    int flushThresholdOperations = settings.getAsInt(INDEX_TRANSLOG_FLUSH_THRESHOLD_OPS, TranslogService.this.flushThresholdOperations);
    if (flushThresholdOperations != TranslogService.this.flushThresholdOperations) {
        logger.info("updating flush_threshold_ops from [{}] to [{}]", TranslogService.this.flushThresholdOperations, flushThresholdOperations);
        TranslogService.this.flushThresholdOperations = flushThresholdOperations;
    }
    ByteSizeValue flushThresholdSize = settings.getAsBytesSize(INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE, TranslogService.this.flushThresholdSize);
    if (!flushThresholdSize.equals(TranslogService.this.flushThresholdSize)) {
        logger.info("updating flush_threshold_size from [{}] to [{}]", TranslogService.this.flushThresholdSize, flushThresholdSize);
        TranslogService.this.flushThresholdSize = flushThresholdSize;
    }
    TimeValue flushThresholdPeriod = settings.getAsTime(INDEX_TRANSLOG_FLUSH_THRESHOLD_PERIOD, TranslogService.this.flushThresholdPeriod);
    if (!flushThresholdPeriod.equals(TranslogService.this.flushThresholdPeriod)) {
        logger.info("updating flush_threshold_period from [{}] to [{}]", TranslogService.this.flushThresholdPeriod, flushThresholdPeriod);
        TranslogService.this.flushThresholdPeriod = flushThresholdPeriod;
    }
    TimeValue interval = settings.getAsTime(INDEX_TRANSLOG_FLUSH_INTERVAL, TranslogService.this.interval);
    if (!interval.equals(TranslogService.this.interval)) {
        logger.info("updating interval from [{}] to [{}]", TranslogService.this.interval, interval);
        TranslogService.this.interval = interval;
    }
    boolean disableFlush = settings.getAsBoolean(INDEX_TRANSLOG_DISABLE_FLUSH, TranslogService.this.disableFlush);
    if (disableFlush != TranslogService.this.disableFlush) {
        logger.info("updating disable_flush from [{}] to [{}]", TranslogService.this.disableFlush, disableFlush);
        TranslogService.this.disableFlush = disableFlush;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:29,代码来源:TranslogService.java

示例8: BM25SimilarityProvider

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public BM25SimilarityProvider(@Assisted String name, @Assisted Settings settings) {
    super(name);
    float k1 = settings.getAsFloat("k1", 1.2f);
    float b = settings.getAsFloat("b", 0.75f);
    boolean discountOverlaps = settings.getAsBoolean("discount_overlaps", true);

    this.similarity = new BM25Similarity(k1, b);
    this.similarity.setDiscountOverlaps(discountOverlaps);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:BM25SimilarityProvider.java

示例9: LengthTokenFilterFactory

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public LengthTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    min = settings.getAsInt("min", 0);
    max = settings.getAsInt("max", Integer.MAX_VALUE);
    if (version.onOrAfter(Version.LUCENE_4_4) && settings.get(ENABLE_POS_INC_KEY) != null) {
        throw new IllegalArgumentException(ENABLE_POS_INC_KEY + " is not supported anymore. Please fix your analysis chain or use"
                + " an older compatibility version (<=4.3) but beware that it might cause highlighting bugs.");
    }
    enablePositionIncrements = version.onOrAfter(Version.LUCENE_4_4) ? true : settings.getAsBoolean(ENABLE_POS_INC_KEY, true);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:12,代码来源:LengthTokenFilterFactory.java

示例10: isCacheEnabled

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
private boolean isCacheEnabled(Settings settings, boolean defaultEnable) {
    Boolean enable = settings.getAsBoolean(INDEX_CACHE_REQUEST_ENABLED, null);
    if (enable == null) {
        enable = settings.getAsBoolean(DEPRECATED_INDEX_CACHE_REQUEST_ENABLED, null);
        if (enable != null) {
            deprecationLogger.deprecated("The [" + DEPRECATED_INDEX_CACHE_REQUEST_ENABLED
                    + "] settings is now deprecated, use [" + INDEX_CACHE_REQUEST_ENABLED + "] instead");
        }
    }
    if (enable == null) {
        enable = defaultEnable;
    }
    return enable;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:IndicesRequestCache.java

示例11: DiskThresholdDecider

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public DiskThresholdDecider(Settings settings, NodeSettingsService nodeSettingsService, ClusterInfoService infoService, Client client) {
    super(settings);
    String lowWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK,
            DEFAULT_LOW_DISK_WATERMARK);
    String highWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK,
            DEFAULT_HIGH_DISK_WATERMARK);

    if (!validWatermarkSetting(lowWatermark, CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK)) {
        throw new ElasticsearchParseException("unable to parse low watermark [{}]", lowWatermark);
    }
    if (!validWatermarkSetting(highWatermark, CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK)) {
        throw new ElasticsearchParseException("unable to parse high watermark [{}]", highWatermark);
    }
    // Watermark is expressed in terms of used data, but we need "free" data watermark
    this.freeDiskThresholdLow = 100.0 - thresholdPercentageFromWatermark(lowWatermark);
    this.freeDiskThresholdHigh = 100.0 - thresholdPercentageFromWatermark(highWatermark);

    this.freeBytesThresholdLow = thresholdBytesFromWatermark(lowWatermark, CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK);
    this.freeBytesThresholdHigh = thresholdBytesFromWatermark(highWatermark, CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK);
    this.includeRelocations = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS,
            DEFAULT_INCLUDE_RELOCATIONS);
    this.rerouteInterval = settings.getAsTime(CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL, TimeValue.timeValueSeconds(60));

    this.enabled = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED,
            DEFAULT_THRESHOLD_ENABLED);
    nodeSettingsService.addListener(new ApplySettings());
    infoService.addListener(new DiskListener(client));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:30,代码来源:DiskThresholdDecider.java

示例12: EngineConfig

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
/**
 * Creates a new {@link org.elasticsearch.index.engine.EngineConfig}
 */
public EngineConfig(ShardId shardId, ThreadPool threadPool, ShardIndexingService indexingService,
                    Settings indexSettings, IndicesWarmer warmer, Store store, SnapshotDeletionPolicy deletionPolicy,
                    MergePolicy mergePolicy, MergeSchedulerConfig mergeSchedulerConfig, Analyzer analyzer,
                    Similarity similarity, CodecService codecService, Engine.FailedEngineListener failedEngineListener,
                    TranslogRecoveryPerformer translogRecoveryPerformer, QueryCache queryCache, QueryCachingPolicy queryCachingPolicy, IndexSearcherWrappingService wrappingService, TranslogConfig translogConfig) {
    this.shardId = shardId;
    this.indexSettings = indexSettings;
    this.threadPool = threadPool;
    this.indexingService = indexingService;
    this.warmer = warmer;
    this.store = store;
    this.deletionPolicy = deletionPolicy;
    this.mergePolicy = mergePolicy;
    this.mergeSchedulerConfig = mergeSchedulerConfig;
    this.analyzer = analyzer;
    this.similarity = similarity;
    this.codecService = codecService;
    this.failedEngineListener = failedEngineListener;
    this.wrappingService = wrappingService;
    this.optimizeAutoGenerateId = indexSettings.getAsBoolean(EngineConfig.INDEX_OPTIMIZE_AUTOGENERATED_ID_SETTING, false);
    this.compoundOnFlush = indexSettings.getAsBoolean(EngineConfig.INDEX_COMPOUND_ON_FLUSH, compoundOnFlush);
    codecName = indexSettings.get(EngineConfig.INDEX_CODEC_SETTING, EngineConfig.DEFAULT_CODEC_NAME);
    // We start up inactive and rely on IndexingMemoryController to give us our fair share once we start indexing:
    indexingBufferSize = IndexingMemoryController.INACTIVE_SHARD_INDEXING_BUFFER;
    gcDeletesInMillis = indexSettings.getAsTime(INDEX_GC_DELETES_SETTING, EngineConfig.DEFAULT_GC_DELETES).millis();
    versionMapSizeSetting = indexSettings.get(INDEX_VERSION_MAP_SIZE, DEFAULT_VERSION_MAP_SIZE);
    updateVersionMapSize();
    this.translogRecoveryPerformer = translogRecoveryPerformer;
    this.forceNewTranslog = indexSettings.getAsBoolean(INDEX_FORCE_NEW_TRANSLOG, false);
    this.queryCache = queryCache;
    this.queryCachingPolicy = queryCachingPolicy;
    this.translogConfig = translogConfig;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:37,代码来源:EngineConfig.java

示例13: DiscoverySettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public DiscoverySettings(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);
    nodeSettingsService.addListener(new ApplySettings());
    this.noMasterBlock = parseNoMasterBlock(settings.get(NO_MASTER_BLOCK, DEFAULT_NO_MASTER_BLOCK));
    this.publishTimeout = settings.getAsTime(PUBLISH_TIMEOUT, publishTimeout);
    this.publishDiff = settings.getAsBoolean(PUBLISH_DIFF_ENABLE, DEFAULT_PUBLISH_DIFF_ENABLE);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:DiscoverySettings.java

示例14: TransportCloseIndexAction

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public TransportCloseIndexAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                 ThreadPool threadPool, MetaDataIndexStateService indexStateService,
                                 NodeSettingsService nodeSettingsService, ActionFilters actionFilters,
                                 IndexNameExpressionResolver indexNameExpressionResolver, DestructiveOperations destructiveOperations) {
    super(settings, CloseIndexAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, CloseIndexRequest.class);
    this.indexStateService = indexStateService;
    this.destructiveOperations = destructiveOperations;
    this.closeIndexEnabled = settings.getAsBoolean(SETTING_CLUSTER_INDICES_CLOSE_ENABLE, true);
    nodeSettingsService.addListener(this);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:12,代码来源:TransportCloseIndexAction.java

示例15: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {
    final boolean enable = settings.getAsBoolean(SETTING_CLUSTER_INDICES_CLOSE_ENABLE, this.closeIndexEnabled);
    if (enable != this.closeIndexEnabled) {
        logger.info("updating [{}] from [{}] to [{}]", SETTING_CLUSTER_INDICES_CLOSE_ENABLE, this.closeIndexEnabled, enable);
        this.closeIndexEnabled = enable;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:TransportCloseIndexAction.java


注:本文中的org.elasticsearch.common.settings.Settings.getAsBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。