added channel effective amount to the claim weight. #141

Merged
tiger5226 merged 2 commits from add_channel_weight into master 2019-02-25 03:52:38 +01:00
2 changed files with 13 additions and 2 deletions
Showing only changes of commit 101e55d924 - Show all commits

View file

@ -63,7 +63,7 @@ function getResults (input) {
},
},
};
const funcScore = { // 100 LBC adds 1 point to the score
const funcScoreClaimWeight = { // 100 LBC adds 1 point to the score
'function_score': {
'script_score': {
'script': {
@ -72,6 +72,15 @@ function getResults (input) {
},
},
};
const funcScoreChannelWeight = { // 100 LBC adds 1 point to the score
'function_score': {
'script_score': {
'script': {
'source': `${effectiveFactor} * doc['certificate_amount'].value`,
},
},
},
};
const matPhraseName = { // Match search text as phrase - Name
'match_phrase': {
'name': {
@ -176,7 +185,8 @@ function getResults (input) {
'bool': {
'should': [
conBoost,
funcScore,
funcScoreClaimWeight,
funcScoreChannelWeight,
],
'must': [
channelSearch,

View file

@ -172,6 +172,7 @@ function getClaimsSince (time, lastID, MaxClaimsInCall) {
`p.name as channel,` +
`c.bid_state,` +
`c.effective_amount,` +
`COALESCE(p.effective_amount,0.0) as certificate_amount,` +
`c.claim_id as claimId,` +
`c.value_as_json as value ` +
`FROM claim c ` +