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.
This commit is contained in:
Abdessamad Derraz committed 2026-10-23 20:19:26 +02:00
1 parent 8a8931e4c6
commit 4ffdcf04b1
6 files changed
+20 -13

No files matched your search

+5 -1
View File
@@ -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):
+1 -1
View File
@@ -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))
+4 -1
View File
@@ -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=[^>]*>([^<]*)</\1>",
# 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'[^>]*>([^<]*)</\1>',
path.read_text(encoding="utf-8")):
if match[2].strip():
texts.append(str(path.relative_to(DIST)))
+1 -1
View File
@@ -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))
+6 -5
View File
@@ -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: [
+3 -4
View File
@@ -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),