當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。