From 20c64e8fe125358da7f292482957d0c3696008ea Mon Sep 17 00:00:00 2001 From: tokebe <43009413+tokebe@users.noreply.github.com> Date: Wed, 1 Feb 2023 11:21:35 -0500 Subject: [PATCH] fix: score log --- src/inferred_mode/inferred_mode.js | 2 +- src/query_results.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/inferred_mode/inferred_mode.js b/src/inferred_mode/inferred_mode.js index e4f6fbfd..e4a5aef9 100644 --- a/src/inferred_mode/inferred_mode.js +++ b/src/inferred_mode/inferred_mode.js @@ -482,7 +482,7 @@ module.exports = class InferredQueryHandler { let scoredResults = 0; let unscoredResults = 0; combinedResponse.message.results.forEach((result) => { - if (result.score > 0) { + if (result.score > 0.1) { scoredResults += 1; } else { unscoredResults += 1; diff --git a/src/query_results.js b/src/query_results.js index c3a9e3c7..ef54edaa 100644 --- a/src/query_results.js +++ b/src/query_results.js @@ -246,7 +246,7 @@ module.exports = class TrapiResultsAssembler { debug(`Updating query results now!`); let scoreCombos = []; - + if (shouldScore) { try { scoreCombos = await getScores(recordsByQEdgeID); @@ -400,12 +400,12 @@ module.exports = class TrapiResultsAssembler { // TODO: replace with better score implementation later const result = {node_bindings: {}, edge_bindings: {}, score: calculateScore(consolidatedSolution, scoreCombos)}; - if (result.score == 0) { + if (result.score === 0.1) { resultsWithoutScore++; } else { resultsWithScore++; } - + if (!shouldScore) delete result.score; consolidatedSolution.forEach(({ @@ -440,8 +440,8 @@ module.exports = class TrapiResultsAssembler { debug(`Successfully scored ${resultsWithScore} results, couldn't score ${resultsWithoutScore} results.`); this.logs.push( new LogEntry( - 'DEBUG', - null, + 'DEBUG', + null, `Successfully scored ${resultsWithScore} results, couldn't score ${resultsWithoutScore} results.`, { type: 'scoring', @@ -454,8 +454,8 @@ module.exports = class TrapiResultsAssembler { debug(`Did not score results for this endpoint.`); this.logs.push( new LogEntry( - 'DEBUG', - null, + 'DEBUG', + null, `Scoring disabled for KP endpoints; results not scored. Use ARA endpoints (/v1/query or /v1/asyncquery) for scoring.`, { type: 'scoring',