Merge pull request #141 from lbryio/add_channel_weight

added channel effective amount to the claim weight.
This commit is contained in:
Mark 2019-02-24 21:52:37 -05:00 committed by GitHub
commit a11eb86338
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 6 deletions

View file

@ -63,13 +63,22 @@ 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': {
'source': `${effectiveFactor} * doc['effective_amount'].value`,
'field_value_factor': {
'field' : 'effective_amount',
'factor' : effectiveFactor,
'missing': 1,
},
},
};
const funcScoreChannelWeight = { // 100 LBC adds 1 point to the score
'function_score': {
'field_value_factor': {
'field' : 'certificate_amount',
'factor' : effectiveFactor,
'missing': 1,
},
},
};
const matPhraseName = { // Match search text as 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 ` +