本文整理匯總了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);
}