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


Java Settings.getAsFloat方法代码示例

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


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

示例1: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {
    final float indexBalance = settings.getAsFloat(SETTING_INDEX_BALANCE_FACTOR,
            BalancedShardsAllocator.this.settings.getAsFloat(SETTING_INDEX_BALANCE_FACTOR,
                    DEFAULT_INDEX_BALANCE_FACTOR));
    final float shardBalance = settings.getAsFloat(SETTING_SHARD_BALANCE_FACTOR,
            BalancedShardsAllocator.this.settings.getAsFloat(SETTING_SHARD_BALANCE_FACTOR,
                    DEFAULT_SHARD_BALANCE_FACTOR));
    float threshold = settings.getAsFloat(SETTING_THRESHOLD,
            BalancedShardsAllocator.this.settings.getAsFloat(SETTING_THRESHOLD, DEFAULT_THRESHOLD));
    if (threshold <= 0.0f) {
        throw new IllegalArgumentException("threshold must be greater than 0.0f but was: " + threshold);
    }
    BalancedShardsAllocator.this.threshold = threshold;
    BalancedShardsAllocator.this.weightFunction = new WeightFunction(indexBalance, shardBalance);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:BalancedShardsAllocator.java

示例2: BM25SimilarityProvider

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
public BM25SimilarityProvider(String name, Settings settings, Settings indexSettings) {
    super(name);
    float k1 = settings.getAsFloat("k1", 1.2f);
    float b = settings.getAsFloat("b", 0.75f);
    final DeprecationLogger deprecationLogger = new DeprecationLogger(ESLoggerFactory.getLogger(getClass()));
    boolean discountOverlaps =
        settings.getAsBooleanLenientForPreEs6Indices(Version.indexCreated(indexSettings), "discount_overlaps", true, deprecationLogger);

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

示例3: 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

示例4: build

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
/**
 * Builds an {@link Ordinals} instance from the builders current state.
 */
public Ordinals build(Settings settings) {
    final float acceptableOverheadRatio = settings.getAsFloat("acceptable_overhead_ratio", PackedInts.FASTEST);
    final boolean forceMultiOrdinals = settings.getAsBoolean(FORCE_MULTI_ORDINALS, false);
    if (forceMultiOrdinals || numMultiValuedDocs > 0 || MultiOrdinals.significantlySmallerThanSinglePackedOrdinals(maxDoc, numDocsWithValue, getValueCount(), acceptableOverheadRatio)) {
        // MultiOrdinals can be smaller than SinglePackedOrdinals for sparse fields
        return new MultiOrdinals(this, acceptableOverheadRatio);
    } else {
        return new SinglePackedOrdinals(this, acceptableOverheadRatio);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:14,代码来源:OrdinalsBuilder.java

示例5: LMJelinekMercerSimilarityProvider

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
public LMJelinekMercerSimilarityProvider(String name, Settings settings, Settings indexSettings) {
    super(name);
    float lambda = settings.getAsFloat("lambda", 0.1f);
    this.similarity = new LMJelinekMercerSimilarity(lambda);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:LMJelinekMercerSimilarityProvider.java

示例6: LMDirichletSimilarityProvider

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
public LMDirichletSimilarityProvider(String name, Settings settings, Settings indexSettings) {
    super(name);
    float mu = settings.getAsFloat("mu", 2000f);
    this.similarity = new LMDirichletSimilarity(mu);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:LMDirichletSimilarityProvider.java

示例7: extract

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public Float extract(Settings settings) {
    return settings.getAsFloat(settingName(), defaultValue());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:5,代码来源:FloatSetting.java

示例8: LMJelinekMercerSimilarityProvider

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public LMJelinekMercerSimilarityProvider(@Assisted String name, @Assisted Settings settings) {
    super(name);
    float lambda = settings.getAsFloat("lambda", 0.1f);
    this.similarity = new LMJelinekMercerSimilarity(lambda);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:LMJelinekMercerSimilarityProvider.java

示例9: LMDirichletSimilarityProvider

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public LMDirichletSimilarityProvider(@Assisted String name, @Assisted Settings settings) {
    super(name);
    float mu = settings.getAsFloat("mu", 2000f);
    this.similarity = new LMDirichletSimilarity(mu);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:LMDirichletSimilarityProvider.java


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