本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例7: extract
import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public Float extract(Settings settings) {
return settings.getAsFloat(settingName(), defaultValue());
}
示例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);
}
示例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);
}