From 4ffdcf04b17375585f7088d9b24319585e954f27 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 23 Oct 2026 20:19:26 +0200 Subject: [PATCH] fix: rank the emulator before its frozen copies A profile pinned to one platform's build (pin_frozen) answers after the emulator, as a frozen_snapshot does: Flycast now answers dc bios missing ahead of Reicast and Flycast 2021 LE. terms weighs 30, so the version table answers which mame version first, and the gate now asks for rank 1 there. The search field test names the five fields, since round 4 item 2.4 put the title meta on the h1. --- scripts/generate_site.py | 6 +++++- tests/test_site_r3_components.py | 2 +- tests/test_site_r3_nav.py | 5 ++++- tests/test_site_r4_components.py | 2 +- website/astro.config.mjs | 11 ++++++----- website/tools/search_gate.py | 7 +++---- 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/scripts/generate_site.py b/scripts/generate_site.py index 1e267865..a2988a18 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -10201,8 +10201,12 @@ def _generate(args: argparse.Namespace) -> None: data_dirs=page_data_directories(name, profiles), ) PAGE_DATA[f"emulators/{name}.md"] = emulator_structured_data(profile) + # A frozen copy answers after the emulator: a frozen_snapshot, and a + # profile pinned to the revision one platform builds (pin_frozen). + # Reicast and Flycast 2021 LE answered "dc bios missing" before Flycast. if (profile.get("type") in ("launcher", "alias") - or profile.get("core_classification") in ("launcher", "alias", "frozen_snapshot")): + or profile.get("core_classification") in ("launcher", "alias", "frozen_snapshot") + or profile.get("pin_frozen")): SEARCH_DEMOTED.add(f"emulators/{name}.md") files = profile.get("files") or [] for stem, entries in emulator_parts(name, files): diff --git a/tests/test_site_r3_components.py b/tests/test_site_r3_components.py index fee1219d..2572e0b9 100644 --- a/tests/test_site_r3_components.py +++ b/tests/test_site_r3_components.py @@ -291,7 +291,7 @@ class SearchFoldsPagesUnderAHash(unittest.TestCase): def test_search_fields_are_weighted_and_never_shown(self): config = _read(CONFIG) - self.assertIn("metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 20 },", config) + self.assertIn("metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 30 },", config) self.assertIn("const UNSHOWN_FIELDS = new Set(['files', 'aliases', 'devices', 'consoles', 'terms']);", _read(SITE_TS)) diff --git a/tests/test_site_r3_nav.py b/tests/test_site_r3_nav.py index 800a37e3..5a7ef2b9 100644 --- a/tests/test_site_r3_nav.py +++ b/tests/test_site_r3_nav.py @@ -202,7 +202,10 @@ class BuiltSite(unittest.TestCase): def test_search_fields_hold_no_text(self) -> None: texts = [] for path in (DIST / "systems").rglob("index.html"): - for match in re.finditer(r"<(\w+)[^>]*data-pagefind-meta=[^>]*>([^<]*)", + # The search fields are attributes on empty spans. The title + # meta reads the visible h1 since round 4 item 2.4. + for match in re.finditer(r'<(\w+)[^>]*data-pagefind-meta="(?:files|aliases|devices|consoles|terms):' + r'[^>]*>([^<]*)', path.read_text(encoding="utf-8")): if match[2].strip(): texts.append(str(path.relative_to(DIST))) diff --git a/tests/test_site_r4_components.py b/tests/test_site_r4_components.py index cd993c15..67bb9f68 100644 --- a/tests/test_site_r4_components.py +++ b/tests/test_site_r4_components.py @@ -214,7 +214,7 @@ class SearchFields(unittest.TestCase): def test_declared_and_never_shown(self): config = _read(CONFIG) - self.assertIn("metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 20 },", config) + self.assertIn("metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 30 },", config) self.assertIn("const UNSHOWN_FIELDS = new Set(['files', 'aliases', 'devices', 'consoles', 'terms']);", _read(SITE_TS)) diff --git a/website/astro.config.mjs b/website/astro.config.mjs index 8ec34d4a..157a23fb 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -114,10 +114,11 @@ export default defineConfig({ // setup's own site names (R36S, Miyoo Mini). `consoles`, the consoles a // manufacturer page holds (Neo Geo, WonderSwan Color), weighs as much // as a title. `terms`, the words of a task or a message on screen (bios - // not found, which mame version, check my dump), weighs twice that: a - // field match scores below a title match, and at 10 the MAME parts, - // whose card titles name MAME files, came before the version table - // for "which mame version". All of them are + // not found, which mame version, check my dump), weighs three times + // that: a field match scores below a title match, and the cards of a + // part page keep their own weight, so below 30 the MAME parts, whose + // card titles name MAME files, came before the version table for + // "which mame version". All of them are // attributes on an empty element, so no text of theirs reaches an // excerpt. pagefind: { @@ -126,7 +127,7 @@ export default defineConfig({ termFrequency: 0.5, termSaturation: 1.4, termSimilarity: 9, - metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 20 }, + metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 30 }, }, }, plugins: [ diff --git a/website/tools/search_gate.py b/website/tools/search_gate.py index 19a59025..d5ede06f 100644 --- a/website/tools/search_gate.py +++ b/website/tools/search_gate.py @@ -61,9 +61,7 @@ QUERIES: dict[str, tuple[tuple[str, ...], int]] = { # The platforms' own names for a console (psx, dc, gba), a search field # of its page. Flycast's page names dc_boot.bin and where it goes. "psx bios": (("systems/sony",), 3), - # Step 3 of the troubleshooting page answers it too: a BIOS setting on - # system/dc, while Flycast adds dc/ itself. - "dc bios missing": (("systems/sega", "emulators/flycast/", "wiki/troubleshooting/"), 3), + "dc bios missing": (("systems/sega", "emulators/flycast/"), 3), "gba bios": (("systems/nintendo",), 3), # The words an emulator prints, and the page that answers them. "bios not found": (("wiki/troubleshooting/",), 3), @@ -71,7 +69,8 @@ QUERIES: dict[str, tuple[tuple[str, ...], int]] = { "offline install": (("wiki/installer/",), 3), # The table of versions, or the FAQ answer headed with the question, # which links it. - "which mame version": (("wiki/technical-faq/", "wiki/faq/"), 3), + # The version table before any MAME part, whose card titles name MAME files. + "which mame version": (("wiki/technical-faq/", "wiki/faq/"), 1), # Checking a dump is what the Find a file page does. "check my dump": (("files/",), 1), "md5 check": (("files/",), 1),