Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 39 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | // ElasticSearch function for entity weight |
3 | // satu function is from includes/Search/RescoreBuilders.php in CirrusSearch |
4 | // The formula is: x^a/(k^a+x^a) |
5 | // NOTE: that satu is always 0.5 when x == k. |
6 | // See also: https://www.desmos.com/calculator/ahuzvkiqmi |
7 | return [ |
8 | 'entity_weight' => [ |
9 | 'score_mode' => 'sum', |
10 | 'functions' => [ |
11 | [ |
12 | // Incoming links: k = 100, since it is normal to have a bunch of incoming links |
13 | 'type' => 'satu', |
14 | 'weight' => '0.6', |
15 | 'params' => [ 'field' => 'incoming_links', 'missing' => 0, 'a' => 1, 'k' => 100 ] |
16 | ], |
17 | [ |
18 | // Site links: k = 20, tens of sites is a lot |
19 | 'type' => 'satu', |
20 | 'weight' => '0.4', |
21 | 'params' => [ 'field' => 'sitelink_count', 'missing' => 0, 'a' => 2, 'k' => 20 ] |
22 | ], |
23 | ], |
24 | ], |
25 | 'entity_weight_boost' => [ |
26 | 'score_mode' => 'sum', |
27 | 'functions' => [ |
28 | [ |
29 | // Incoming links: k = 100, since it is normal to have a bunch of incoming links |
30 | 'type' => 'satu', |
31 | 'weight' => '0.6', |
32 | 'params' => [ 'field' => 'incoming_links', 'missing' => 0, 'a' => 1, 'k' => 100 ] |
33 | ], |
34 | [ |
35 | // Site links: k = 20, tens of sites is a lot |
36 | 'type' => 'satu', |
37 | 'weight' => '0.4', |
38 | 'params' => [ 'field' => 'sitelink_count', 'missing' => 0, 'a' => 2, 'k' => 20 ] |
39 | ], |
40 | [ |
41 | // (De)boosting by statement values, see statementBoost in search settings |
42 | 'type' => 'term_boost', |
43 | 'weight' => '0.1', |
44 | 'params' => [ |
45 | 'statement_keywords' => '_statementBoost_' |
46 | ] |
47 | ] |
48 | ], |
49 | ], |
50 | ]; |