Skip to content

Latest commit

 

History

History
180 lines (143 loc) · 4.86 KB

File metadata and controls

180 lines (143 loc) · 4.86 KB

Production Integration Summary

Problem Identified

All our improvements were only in the test endpoints, not in the production search flow:

Feature Test Endpoint Production Status Before Fix
Alternative names matching Not used
Steam Store API descriptions Not used
FitGirl "Game Description" extraction Not used
Enhanced scoring algorithm Not used

Root Cause

The production code in GamesService.searchDownloadCandidates() was calling:

const result = await agent.search(game.name);  // Basic search

Instead of:

const result = await agent.searchEnhanced(game.name, {  // Enhanced search
  igdbGame: game,
});

Changes Made

1. apps/api/src/services/games/GamesService.ts

Updated searchDownloadCandidates method:

// Before: Basic search
const result = await agent.search(game.name);

// After: Enhanced search with full IGDB data
const result = await agent.searchEnhanced(game.name, {
  igdbGame: game,
});

2. apps/api/src/clients/IGDBClient.ts

Added missing fields to getGameById:

fields alternative_names.id, alternative_names.name, alternative_names.comment;
fields websites.id, websites.url, websites.category;

Added missing fields to getGamesByIds:

fields alternative_names.id, alternative_names.name, alternative_names.comment;
fields websites.id, websites.url, websites.category;

Verification Tests

Test 1: Baldur's Gate 3 (Alternative Names)

curl "http://localhost:3000/api/v1/games/119171/candidates"

Result:

[{
  "title": "Baldur's Gate 3: Digital Deluxe Edition – v4.1.1.6758295...",
  "matchScore": 86,
  "matchReasons": [
    "matches alternative title",  // <-- Using alternative names!
    "all main keywords present",
    "sequel number matches"
  ]
}]

Before Fix: ❌ Not found
After Fix: ✅ Found with 86/100 score

Test 2: Spider-Man Miles Morales (Full Pipeline)

curl "http://localhost:3000/api/v1/games/134581/candidates"

Result:

[{
  "title": "Marvel's Spider-Man: Miles Morales – v1.1116.0.0 + DLC + Bonus OST",
  "matchScore": 100,
  "matchReasons": [
    "exact name match",
    "exact phrase in title",
    "matches alternative title",  // <-- Using alternative names!
    "strong title match",
    "all main keywords present"
  ]
}]

Before Fix: ❌ Not found (45/100 in tests)
After Fix: ✅ Perfect 100/100 match

Test 3: Elden Ring (Steam Description)

curl "http://localhost:3000/api/v1/games/119133/candidates"

Result:

[{
  "title": "ELDEN RING: Shadow of the Erdtree Deluxe Edition...",
  "matchScore": 88
}, {
  "title": "ELDEN RING NIGHTREIGN: Deluxe Edition...",
  "matchScore": 85
}]

Before Fix: ⚠️ Basic matching
After Fix: ✅ Enhanced matching with description comparison

What's Now Active in Production

✅ Alternative Names Matching

Games with different naming conventions now match:

  • "Baldur's Gate III" ↔ "Baldur's Gate 3"
  • "Marvel's Spider-Man" ↔ "Spiderman"

✅ Steam Store API Descriptions

Full game descriptions from Steam API (not truncated HTML):

  • Better description similarity scoring
  • "strong Steam description match" bonus (+40 points)

✅ FitGirl Game Description Extraction

Extracts actual game description from FitGirl pages:

  • Looks for "Game Description" div
  • Avoids repack metadata (file sizes, download links)

✅ Enhanced Scoring Algorithm

All scoring improvements now active:

  • Unicode apostrophe handling (U+0027, U+2019)
  • Special character normalization (ö→o, ä→a, etc.)
  • Version/edition suffix removal
  • Word match ratio bonuses

Impact Summary

Metric Before After
Baldur's Gate 3 ❌ Not found ✅ 86/100
Spider-Man Miles Morales ❌ 45/100 ✅ 100/100
Elden Ring ⚠️ Basic ✅ Enhanced
Alternative names used ❌ No ✅ Yes
Steam descriptions ❌ No ✅ Yes

Affected Endpoints

All these endpoints now use the enhanced search:

  1. GET /api/v1/games/:igdbId/candidates - Search download candidates
  2. POST /api/v1/games/check - Check monitored games (periodic)

Backward Compatibility

✅ All changes are backward compatible:

  • Response format unchanged
  • Existing functionality preserved
  • Only adds new fields (alternativeNames, steamAppId)
  • Enhanced matching is automatic

Logs Verification

Production logs now show:

[GamesService] Game has 6 alternative names, 14 websites
[FitGirl] Using alternative name for search: "Baldur's Gate 3"
[FitGirl] ✓ Using Steam description for matching (2730 chars)
[Match] Checking alt: "Baldur's Gate 3" -> clean: "baldurs gate 3"
[Match] ✓ Title "Baldur's Gate 3" matches alternative name