Add channel weight #140

Closed
tiger5226 wants to merge 4 commits from add_channel_weight into master
2 changed files with 14 additions and 2 deletions
Showing only changes of commit 258c378188 - 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': { 'function_score': {
'script_score': { 'script_score': {
'script': { 'script': {
@ -72,6 +72,16 @@ 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 const matPhraseName = { // Match search text as phrase - Name
'match_phrase': { 'match_phrase': {
'name': { 'name': {
@ -176,7 +186,8 @@ function getResults (input) {
'bool': { 'bool': {
'should': [ 'should': [
conBoost, conBoost,
funcScore, funcScoreClaimWeight,
funcScoreChannelWeight,
], ],
'must': [ 'must': [
channelSearch, channelSearch,

View file

@ -161,6 +161,7 @@ function getClaimsSince (time) {
`SELECT ` + `SELECT ` +
`c.name,` + `c.name,` +
`p.name as channel,` + `p.name as channel,` +
`p.effective_amount as certificate_amount` +
`c.bid_state,` + `c.bid_state,` +
`c.effective_amount,` + `c.effective_amount,` +
`c.claim_id as claimId,` + `c.claim_id as claimId,` +