From f7a0a7f263fe9b3fb2bd80b5aface8b7be640b32 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 10 Nov 2026 08:41:03 +0100 Subject: [PATCH] fix: keep the date and Next steps out of search A query word matches the start of a longer word. Since the index grew, the "2" of "playstation 2 bios" matched the 2026 of every page's date line and the "u" of "wii u bios" the "use" of Next steps, so the PlayStation and Nintendo pages held every query word and ranked above the PlayStation 2 and Wii U pages. Both blocks carry data-pagefind-ignore now: search_gate answers 58 of 58 queries, the four console pairs by 9 to 14 percent. Batocera's pages weigh 882 bytes more for it. --- scripts/generate_site.py | 10 +++++++--- scripts/sitestarlight.py | 5 +++++ tests/test_site_platform_density.py | 6 ++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/generate_site.py b/scripts/generate_site.py index a0d16497b..34369fd51 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -402,8 +402,11 @@ def data_as_of(moment: datetime | None = None) -> str: def _date_line() -> str: - """The date a page closes on, in the words of data_as_of().""" - return f'
' + """The date a page closes on, in the words of data_as_of(). The search + does not read it: a query word such as the "2" of "playstation 2 bios" + also matches the start of "2026", and every page closing on the date + then held every word of the query.""" + return f'' # Home page @@ -5523,7 +5526,8 @@ def generate_provenance_page( lines = [ "# Dump provenance", "", - *([f'', ""] if as_of else []), + *([f'', ""] + if as_of else []), "Provenance says whether a file is, byte for byte, a dump that Redump, " "No-Intro or TOSEC catalogues. It says where a dump is known from, " "not whether an emulator accepts it: that is the emulator's code, read " diff --git a/scripts/sitestarlight.py b/scripts/sitestarlight.py index e8934b690..4bd8305e3 100644 --- a/scripts/sitestarlight.py +++ b/scripts/sitestarlight.py @@ -577,6 +577,11 @@ def finalize_page( # is a name, and stays: it is how "neogeo.zip" finds the cores reading it. body = re.sub(r'\n\n{match[0].rstrip()}\n\n\n\n", body, count=1) if rel.startswith("systems/"): body += file_names_meta(body) + search_field("aliases", page_aliases(rel)) consoles = field_words(authored.get("consoles")) diff --git a/tests/test_site_platform_density.py b/tests/test_site_platform_density.py index 4421bbc04..aa576e756 100644 --- a/tests/test_site_platform_density.py +++ b/tests/test_site_platform_density.py @@ -268,8 +268,10 @@ BEFORE_WEIGHT = { # Elektronika BK, FM Towns and Nintendo DS moved to part pages. Built # site of 27c33b966: 13 pages, 15,662 elements, 1,356,360 bytes, and 40 # bytes more where its Amiberry build is named "Amiberry 8.0.0 - # (facaaeb, Batocera)" (twice). - "batocera": (13, 18_854, 1_356_400), + # (facaaeb, Batocera)" (twice). The search stopped reading the date + # line and "Next steps" on 2026-11-10 (data-pagefind-ignore, about 68 + # bytes a page): 1,357,282 bytes on the built site of 25057ee3a. + "batocera": (13, 18_854, 1_357_282), "amberelec": (1, 7_928, 473_388), "romm": (2, 9_561, 572_487), "retroarch": (14, 21_503, 1_430_802),