Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
IncomingLinksFunctionScoreBuilder | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
append | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace CirrusSearch\Search\Rescore; |
4 | |
5 | use Elastica\Query\FunctionScore; |
6 | |
7 | /** |
8 | * Builds a function that boosts incoming links |
9 | * formula is log( incoming_links + 2 ) |
10 | */ |
11 | class IncomingLinksFunctionScoreBuilder implements BoostFunctionBuilder { |
12 | public function append( FunctionScore $functionScore ) { |
13 | $functionScore->addFunction( 'field_value_factor', [ |
14 | 'field' => 'incoming_links', |
15 | 'modifier' => 'log2p', |
16 | 'missing' => 0, |
17 | ] ); |
18 | } |
19 | } |