CirrusSearch
Elasticsearch-powered search for MediaWiki
|
Utility function to compute a weighted geometric mean. More...
Public Member Functions | |
__construct (SearchConfig $config, $weight, $profile) | |
getScript () | |
Build a weighted geometric mean using a logarithmic arithmetic mean. | |
append (FunctionScore $functionScore) | |
Append functions to the function score $container. | |
Public Member Functions inherited from CirrusSearch\Search\Rescore\FunctionScoreBuilder | |
__construct ( $config, $weight) | |
Additional Inherited Members | |
Protected Member Functions inherited from CirrusSearch\Search\Rescore\FunctionScoreBuilder | |
getOverriddenFactor ( $value) | |
Utility method to extract a factor (float) that can be overridden by a config value or an URI param. | |
Protected Attributes inherited from CirrusSearch\Search\Rescore\FunctionScoreBuilder | |
$config | |
$weight | |
Utility function to compute a weighted geometric mean.
According to https://en.wikipedia.org/wiki/Weighted_geometric_mean this is equivalent to exp ( w1*ln(value1)+w2*ln(value2) / (w1 + w2) ) ^ impact impact is applied as a power factor because this function is applied in a multiplication. Members can use only LogScaleBoostFunctionScoreBuilder or SatuFunctionScoreBuilder these are the only functions that normalize the value in the [0,1] range.
CirrusSearch\Search\Rescore\GeoMeanFunctionScoreBuilder::__construct | ( | SearchConfig | $config, |
$weight, | |||
$profile ) |
SearchConfig | $config | |
float | $weight | |
array | $profile |
InvalidRescoreProfileException |
CirrusSearch\Search\Rescore\GeoMeanFunctionScoreBuilder::append | ( | FunctionScore | $container | ) |
Append functions to the function score $container.
FunctionScore | $container |
Implements CirrusSearch\Search\Rescore\BoostFunctionBuilder.
CirrusSearch\Search\Rescore\GeoMeanFunctionScoreBuilder::getScript | ( | ) |
Build a weighted geometric mean using a logarithmic arithmetic mean.
exp(w1*ln(value1)+w2*ln(value2) / (w1+w2)) NOTE: We need to use an epsilon value in case value is 0.