mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-11 20:43:50 -06:00
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.
This commit is contained in:
1 parent
25057ee3a2
commit
f7a0a7f263
3 files changed
+16
-5
No files matched your search
@@ -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'<div class="rb-timestamp">{data_as_of()}.</div>'
|
||||
"""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'<div class="rb-timestamp" data-pagefind-ignore>{data_as_of()}.</div>'
|
||||
|
||||
|
||||
# Home page
|
||||
@@ -5523,7 +5526,8 @@ def generate_provenance_page(
|
||||
lines = [
|
||||
"# Dump provenance",
|
||||
"",
|
||||
*([f'<p class="rb-timestamp">Catalogs as of: {as_of}.</p>', ""] if as_of else []),
|
||||
*([f'<p class="rb-timestamp" data-pagefind-ignore>Catalogs as of: {as_of}.</p>', ""]
|
||||
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 "
|
||||
|
||||
@@ -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'<span class="(rb-badge(?![^"]*rb-badge-archive)[^"]*)"',
|
||||
r'<span data-pagefind-ignore class="\1"', body)
|
||||
# "Next steps" closes most pages with the same links ("for the setup in
|
||||
# use"): the "u" of "wii u bios" matched the start of "use" there, and
|
||||
# the Nintendo page came before the Wii U page.
|
||||
body = _NEXT_STEPS.sub(
|
||||
lambda match: f"<div data-pagefind-ignore>\n\n{match[0].rstrip()}\n\n</div>\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"))
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user