From b64ef9f97a07e2e056d4a2c0c62eefd95bab4212 Mon Sep 17 00:00:00 2001
From: filipnyquist <filip@lbry.io>
Date: Wed, 22 Aug 2018 16:38:15 +0200
Subject: [PATCH] Added back #81

Added back:
Updated search query to include controlling and effective amount weights. Also made sure the results are sorted properly so highest score is at the top.
---
 server/controllers/lighthouse.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/server/controllers/lighthouse.js b/server/controllers/lighthouse.js
index d015cf3..6fefee1 100644
--- a/server/controllers/lighthouse.js
+++ b/server/controllers/lighthouse.js
@@ -56,6 +56,15 @@ function getResults (input) {
       },
     },
   };
+  const funcScore = { // 100 LBC adds 1 point to the score
+    'function_score': {
+      'script_score': {
+        'script': {
+          'source': "0.00000001 * doc['effective_amount'].value",
+        },
+      },
+    },
+};
   const matPhraseName = { // Match search text as phrase - Name
     'match_phrase': {
       'name': {
@@ -160,6 +169,7 @@ function getResults (input) {
         'bool': {
           'should': [
             conBoost,
+            funcScore,
           ],
           'must': [
             channelSearch,