From 79a24705041716f114fa04b8eaff8b25e41095fa Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 24 Feb 2019 22:05:39 -0500 Subject: [PATCH] Revert "added channel effective amount to the claim weight." --- server/controllers/lighthouse.js | 22 ++++++---------------- server/utils/chainquery/index.js | 1 - 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/server/controllers/lighthouse.js b/server/controllers/lighthouse.js index 8ea704e..27466f1 100644 --- a/server/controllers/lighthouse.js +++ b/server/controllers/lighthouse.js @@ -63,21 +63,12 @@ function getResults (input) { }, }, }; - const funcScoreClaimWeight = { // 100 LBC adds 1 point to the score + const funcScore = { // 100 LBC adds 1 point to the score 'function_score': { - '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, + 'script_score': { + 'script': { + 'source': `${effectiveFactor} * doc['effective_amount'].value`, + }, }, }, }; @@ -185,8 +176,7 @@ function getResults (input) { 'bool': { 'should': [ conBoost, - funcScoreClaimWeight, - funcScoreChannelWeight, + funcScore, ], 'must': [ channelSearch, diff --git a/server/utils/chainquery/index.js b/server/utils/chainquery/index.js index 4dfb7b2..d198329 100644 --- a/server/utils/chainquery/index.js +++ b/server/utils/chainquery/index.js @@ -172,7 +172,6 @@ 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 ` + -- 2.45.2