🏗️ Refactored CV search match scorer

This commit is contained in:
2024-01-04 23:33:02 -05:00
parent 395e25aa37
commit 5004dd5990
2 changed files with 107 additions and 55 deletions

View File

@@ -190,6 +190,8 @@ export default class ComicVineService extends Service {
"Searching against: ",
ctx.params.scorerConfiguration.searchParams
);
const { rawFileDetails, scorerConfiguration } =
ctx.params;
const results: any = [];
console.log(
"passed to fetchVolumesFromCV",
@@ -290,12 +292,44 @@ export default class ComicVineService extends Service {
return issue;
}
);
// Score the final matches
const foo = await this.broker.call(
"comicvine.getComicVineMatchScores",
{
finalMatches,
rawFileDetails,
scorerConfiguration,
}
);
return Promise.all(finalMatches);
} catch (error) {
console.log(error);
}
},
},
getComicVineMatchScores: {
rest: "POST /getComicVineMatchScores",
handler: async (
ctx: Context<{
finalMatches: Array<any>;
rawFileDetails: any;
scorerConfiguration: any;
}>
) => {
const {
finalMatches,
rawFileDetails,
scorerConfiguration,
} = ctx.params;
console.log(ctx.params);
return await matchScorer(
finalMatches,
scorerConfiguration.searchParams,
rawFileDetails
);
},
},
},
methods: {
fetchVolumesFromCV: async (payload, output: any[] = []) => {