fix: answer the search gate's missed queries

terms weighs 20, so the version table outranks MAME parts. The FAQ carries ios, iphone, ipad, the file page check my dump, and a console's regional lead names it (the PlayStation BIOS). The FAQ quotes the bootstrap's fingerprint message again. The troubleshooting page, which answers the dc/ trap, joins the pages that answer dc bios missing. The gate starts node without its compile cache.
This commit is contained in:
Abdessamad Derraz committed 2026-10-23 20:04:38 +02:00
1 parent e5cd024e2e
commit b5173ce72f
6 files changed
+28 -16

No files matched your search

+8 -6
View File
@@ -111,11 +111,13 @@ export default defineConfig({
// every other query. Two fields name the page's subject in other words
// and weigh half a title: `aliases`, the ids setups file a system under
// (psx, dreamcast, gba), and `devices`, the handhelds and boxes a
// setup's own site names (R36S, Miyoo Mini). Two more weigh as much as
// a title, since each names what a reader types to reach the page:
// `consoles`, the consoles a manufacturer page holds (Neo Geo,
// WonderSwan Color), and `terms`, the words of a task or a message on
// screen (bios not found, mame version, check dump). All of them are
// 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
// attributes on an empty element, so no text of theirs reaches an
// excerpt.
pagefind: {
@@ -124,7 +126,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: 10 },
metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 20 },
},
},
plugins: [
+12 -4
View File
@@ -18,6 +18,7 @@ from __future__ import annotations
import argparse
import json
import os
import socket
import subprocess
import sys
@@ -60,7 +61,9 @@ 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),
"dc bios missing": (("systems/sega", "emulators/flycast/"), 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),
"gba bios": (("systems/nintendo",), 3),
# The words an emulator prints, and the page that answers them.
"bios not found": (("wiki/troubleshooting/",), 3),
@@ -91,11 +94,16 @@ def _free_port() -> int:
return int(probe.getsockname()[1])
# Node's compile cache fills /tmp (a 4 GB tmpfs under WSL): every node this
# gate starts runs without it.
NODE_ENV = {**os.environ, "NODE_DISABLE_COMPILE_CACHE": "1"}
@contextmanager
def served(site_dir: Path) -> Iterator[str]:
"""The build served by serve.mjs on a free port, for the run."""
port = _free_port()
server = subprocess.Popen(["node", str(TOOLS / "serve.mjs"), str(site_dir), str(port)])
server = subprocess.Popen(["node", str(TOOLS / "serve.mjs"), str(site_dir), str(port)], env=NODE_ENV)
url = f"http://127.0.0.1:{port}{BASE}"
try:
for _ in range(100):
@@ -118,7 +126,7 @@ def run_gate(base: str) -> int:
root = "/" + base.split("/", 3)[3]
run = subprocess.run(
["node", str(TOOLS / "measure.mjs"), "search", base, "starlight-ui", *QUERIES],
capture_output=True, text=True, check=False,
capture_output=True, text=True, check=False, env=NODE_ENV,
)
if run.returncode:
print(run.stderr.strip() or f"measure.mjs exited with {run.returncode}", file=sys.stderr)
@@ -146,7 +154,7 @@ def home_weight(base: str) -> float:
"""The home page's transfer at 390 px, once the network is idle."""
run = subprocess.run(
["node", str(TOOLS / "measure.mjs"), "weight", base, ""],
capture_output=True, text=True, check=True,
capture_output=True, text=True, check=True, env=NODE_ENV,
)
return float(json.loads(run.stdout.splitlines()[0])["total_kb"])