changes to function

This commit is contained in:
Niko Storni 2019-12-02 18:46:12 +01:00
parent 08068a2a47
commit 7aa5cc0c4b

View file

@ -80,32 +80,42 @@ function getResults (input) {
}, },
}, },
}; };
const newerBoost = [ // New claims should come up further up const newerBoost = {
{ 'function_score': {
'range': { 'score_mode': 'sum', // All functions outputs get summed
'transaction_time': { 'boost_mode': 'multiply', // The documents relevance is multiplied with the sum
'boost': 5,
'gte' : new Date().setDate(Date.now() - 30), 'functions': [
{
// The relevancy of old posts is multiplied by at least one.
// Remove if you want to exclude old posts
'weight': 1,
}, },
}, {
}, // Published this month get a big boost
{ 'weight': 50,
'range': { 'gauss' : {
'transaction_time': { 'transaction_time': { // <- Change to your date field name
'boost': 4, 'origin': Date.now(), // Change to current date
'gte' : new Date().setDate(Date.now() - 60), 'scale' : '31d',
'decay' : 0.5,
},
},
}, },
}, {
}, // Published this year get a boost
{ 'weight': 20,
'range': { 'gauss' : {
'transaction_time': { 'transaction_time': { // <- Change to your date field name
'boost': 3, 'origin': Date.now(), // Change to current date
'gte' : new Date().setDate(Date.now() - 90), 'scale' : '356d',
'decay' : 0.5,
},
},
}, },
}, ],
}, },
]; };
const funcScoreClaimWeight = { // 100 LBC adds 1 point to the score const funcScoreClaimWeight = { // 100 LBC adds 1 point to the score
'function_score': { 'function_score': {
'field_value_factor': { 'field_value_factor': {