From 38d4e5d5ed90a673297d5a7c6669476da0f26ba2 Mon Sep 17 00:00:00 2001 From: iPromKnight Date: Thu, 29 Feb 2024 21:47:07 +0000 Subject: [PATCH] Allow user control of threshold --- deployment/docker/.env.example | 2 ++ .../consumer/src/lib/models/configuration/metadata_config.ts | 3 ++- src/node/consumer/src/lib/mongo/mongo_repository.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/deployment/docker/.env.example b/deployment/docker/.env.example index 785272b..8ec6480 100644 --- a/deployment/docker/.env.example +++ b/deployment/docker/.env.example @@ -48,6 +48,8 @@ UDP_TRACKERS_ENABLED=true CONSUMER_REPLICAS=3 ## Fix for #66 - toggle on for development AUTO_CREATE_AND_APPLY_MIGRATIONS=false +## Allows control of the threshold for matching titles to the IMDB dataset. The closer to 0, the more strict the matching. +TITLE_MATCH_THRESHOLD=0.25 # Producer GITHUB_PAT= diff --git a/src/node/consumer/src/lib/models/configuration/metadata_config.ts b/src/node/consumer/src/lib/models/configuration/metadata_config.ts index 32b4e33..d728c10 100644 --- a/src/node/consumer/src/lib/models/configuration/metadata_config.ts +++ b/src/node/consumer/src/lib/models/configuration/metadata_config.ts @@ -1,4 +1,5 @@ export const metadataConfig = { IMDB_CONCURRENT: parseInt(process.env.IMDB_CONCURRENT || "1", 10), - IMDB_INTERVAL_MS: parseInt(process.env.IMDB_INTERVAL_MS || "1000", 10) + IMDB_INTERVAL_MS: parseInt(process.env.IMDB_INTERVAL_MS || "1000", 10), + TITLE_MATCH_THRESHOLD: Number(process.env.TITLE_MATCH_THRESHOLD || 0.25), }; \ No newline at end of file diff --git a/src/node/consumer/src/lib/mongo/mongo_repository.ts b/src/node/consumer/src/lib/mongo/mongo_repository.ts index ad55f11..82e7db1 100644 --- a/src/node/consumer/src/lib/mongo/mongo_repository.ts +++ b/src/node/consumer/src/lib/mongo/mongo_repository.ts @@ -13,7 +13,7 @@ import mongoose from 'mongoose'; const fuseOptions : IFuseOptions = { includeScore: true, keys: ['PrimaryTitle', 'OriginalTitle'], - threshold: 0.25, + threshold: configurationService.metadataConfig.TITLE_MATCH_THRESHOLD, }; @injectable()