Skip to content

Commit

Permalink
fix: score log
Browse files Browse the repository at this point in the history
  • Loading branch information
tokebe committed Feb 1, 2023
1 parent 62b4ea1 commit 20c64e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/inferred_mode/inferred_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/query_results.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ module.exports = class TrapiResultsAssembler {
debug(`Updating query results now!`);

let scoreCombos = [];

if (shouldScore) {
try {
scoreCombos = await getScores(recordsByQEdgeID);
Expand Down Expand Up @@ -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(({
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down

0 comments on commit 20c64e8

Please sign in to comment.