mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-09 03:23:47 -06:00
chore: merge round 5 search fixes
This commit is contained in:
commit
fecc6d9d32
15 files changed
+642
-67
No files matched your search
+25
-14
@@ -108,26 +108,37 @@ export default defineConfig({
|
||||
// ten times its text, so "dolphin" finds Dolphin, and the file names of
|
||||
// a system page (its `files` field, written by sitestarlight.py) count
|
||||
// half, so "scph5501" finds the Sony page without a file name winning
|
||||
// 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). `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 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.
|
||||
// every other query. `devices`, the handhelds and boxes a setup's own
|
||||
// site names (R36S, Miyoo Mini), weighs half a title. `aliases`, the ids
|
||||
// setups file a system under (psx, dreamcast, gba), weighs a title: with
|
||||
// file names written as their parts, half a title put GBA.emu and two
|
||||
// more emulators above the Nintendo page for "gba bios". `terms`, the
|
||||
// words of a task or a message on screen (bios not found, which mame
|
||||
// version, check my dump), weighs three titles: 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".
|
||||
//
|
||||
// A field adds the same score to every page whose field holds the
|
||||
// word, whatever else the field holds, and a query word also matches
|
||||
// the start of a longer one. `consoles`, the consoles a system page
|
||||
// answers for, weighs ten titles: below that an emulator named after
|
||||
// its console (Saturn.emu, BK, PIECE) came before the console. The
|
||||
// PlayStation 2 page holds every word of "playstation bios", so
|
||||
// `exact` repeats, on its own page, a console whose every word another
|
||||
// page's consoles hold (PlayStation, Nintendo DS, Nintendo Super
|
||||
// System). It weighs two titles: enough over the other page, and less
|
||||
// than the "3" of "playstation 3 bios" adds to the Sony page. Measured
|
||||
// on the "<console> bios" query of every system page and on
|
||||
// tools/search_gate.py. All of them are attributes on an empty
|
||||
// element, so no text of theirs reaches an excerpt.
|
||||
pagefind: {
|
||||
ranking: {
|
||||
pageLength: 0.1,
|
||||
termFrequency: 0.5,
|
||||
termSaturation: 1.4,
|
||||
termSimilarity: 9,
|
||||
metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 30 },
|
||||
metaWeights: { title: 10, files: 0.5, aliases: 10, devices: 5, consoles: 100, exact: 20, terms: 30 },
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// What each page knows of its place in the site, computed once per page
|
||||
// from what scripts/sitestarlight.py writes beside the sidebar:
|
||||
// - breadcrumbs: the tab and the groups above the page, each linked to the
|
||||
// page or the section that introduces it, never to a sibling page;
|
||||
// page or the section that introduces it, never to a sibling page. A
|
||||
// group of names by their first letter (A, B) is no crumb;
|
||||
// - previous and next: the reading order of `reading`. Start here runs on
|
||||
// into Your setup, every other tab is read on its own, and a system,
|
||||
// emulator or platform page has none;
|
||||
@@ -19,7 +20,7 @@ import sidebar from './generated/sidebar.json' with { type: 'json' };
|
||||
|
||||
type Entry = StarlightRouteData['sidebar'][number];
|
||||
type Link = Extract<Entry, { type: 'link' }>;
|
||||
type Group = { href: string | null; prune: boolean };
|
||||
type Group = { href: string | null; prune: boolean; crumb?: boolean };
|
||||
export type Crumb = { label: string; href?: string };
|
||||
|
||||
const BASE = import.meta.env.BASE_URL.replace(/\/?$/, '/');
|
||||
@@ -55,7 +56,11 @@ const trail = (entries: Entry[], labels: string[]): Crumb[] | undefined => {
|
||||
const here = [...labels, entry.label];
|
||||
const below = trail(entry.entries, here);
|
||||
if (below) {
|
||||
const href = groupOf(here)?.href;
|
||||
const group = groupOf(here);
|
||||
// A group of names by their first letter is a way through the
|
||||
// list, not a place: the crumb stops at the list.
|
||||
if (group?.crumb === false) return below;
|
||||
const href = group?.href;
|
||||
return [{ label: entry.label, href: href ? withBase(href) : undefined }, ...below];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -784,11 +784,11 @@ const hashLookupRow = (drawer: HTMLElement, value: string) => {
|
||||
|
||||
// Pagefind lists a page's title twice: once for the page and once for the
|
||||
// anchor of its h1 (#_top). The second title is hidden, its excerpt kept.
|
||||
// The `files`, `aliases`, `devices`, `consoles` and `terms` fields weigh in
|
||||
// The `files`, `aliases`, `devices`, `consoles`, `exact` and `terms` fields weigh in
|
||||
// the ranking and are never shown: a result is not a list of 120 names. Pagefind reuses
|
||||
// its nodes from one query to the next, so both are worked out again on
|
||||
// every change.
|
||||
const UNSHOWN_FIELDS = new Set(['files', 'aliases', 'devices', 'consoles', 'terms']);
|
||||
const UNSHOWN_FIELDS = new Set(['files', 'aliases', 'devices', 'consoles', 'exact', 'terms']);
|
||||
|
||||
const tidyResults = (root: Element) => {
|
||||
for (const title of root.querySelectorAll<HTMLElement>('.pagefind-ui__result-nested > .pagefind-ui__result-title')) {
|
||||
|
||||
@@ -63,6 +63,26 @@ QUERIES: dict[str, tuple[tuple[str, ...], int]] = {
|
||||
"psx bios": (("systems/sony",), 3),
|
||||
"dc bios missing": (("systems/sega", "emulators/flycast/"), 3),
|
||||
"gba bios": (("systems/nintendo",), 3),
|
||||
# A console whose page answers "No file needed" says BIOS only where the
|
||||
# search does not read: its `terms` field carries "<name> BIOS".
|
||||
"snes bios": (("systems/nintendo-snes/",), 1),
|
||||
"nes bios": (("systems/nintendo-nes/",), 1),
|
||||
"gamecube bios": (("systems/nintendo-gamecube/",), 1),
|
||||
"game boy bios": (("systems/nintendo-game-boy/",), 1),
|
||||
"3ds bios": (("systems/nintendo-3ds/",), 1),
|
||||
# A console another one's name begins with, both ways: the longer name's
|
||||
# page holds every word of the shorter query. GBA, GBC and the
|
||||
# PlayStation 3 are sections of their maker's page; Saturn.emu is an
|
||||
# emulator named after its console.
|
||||
"playstation 2 bios": (("systems/sony-playstation-2/",), 1),
|
||||
"playstation 3 bios": (("systems/sony/",), 1),
|
||||
"game boy advance bios": (("systems/nintendo/",), 1),
|
||||
"game boy color bios": (("systems/nintendo/",), 1),
|
||||
"nintendo ds bios": (("systems/nintendo-nintendo-ds/",), 1),
|
||||
"nintendo dsi bios": (("systems/nintendo-nintendo-dsi/",), 1),
|
||||
"wii bios": (("systems/nintendo/",), 1),
|
||||
"wii u bios": (("systems/nintendo-wii-u/",), 1),
|
||||
"saturn bios": (("systems/sega-saturn/",), 1),
|
||||
# The words an emulator prints, and the page that answers them.
|
||||
"bios not found": (("wiki/troubleshooting/",), 3),
|
||||
"please insert playstation cd-rom": (("wiki/troubleshooting/",), 3),
|
||||
@@ -74,12 +94,20 @@ QUERIES: dict[str, tuple[tuple[str, ...], int]] = {
|
||||
# Checking a dump is what the Find a file page does.
|
||||
"check my dump": (("files/",), 1),
|
||||
"md5 check": (("files/",), 1),
|
||||
"is my bios correct": (("files/",), 3),
|
||||
# A folder is checked by the setup's command, which troubleshooting runs.
|
||||
"check my bios folder": (("wiki/troubleshooting/",), 3),
|
||||
# A tool author's words: the data reference or the installer's.
|
||||
"manifest": (("data/", "wiki/installer/"), 3),
|
||||
"events": (("data/", "wiki/installer/"), 3),
|
||||
"exit code": (("data/", "wiki/installer/"), 3),
|
||||
"rate limit": (("data/", "wiki/installer/"), 3),
|
||||
"ios": (("wiki/faq/",), 3),
|
||||
"schema": (("data/",), 3),
|
||||
"json schema": (("data/",), 3),
|
||||
"license": (("data/", "wiki/legal/"), 3),
|
||||
"check bios folder script": (("data/",), 3),
|
||||
# The iPhone and iPad answer: copy the files to the app, no terminal.
|
||||
"ios": (("which-pack/", "wiki/faq/"), 3),
|
||||
# A device name: the guide of the handhelds that run it.
|
||||
"r36s": (("platforms/", "which-pack/"), 3),
|
||||
"steam deck": (("platforms/emudeck/", "platforms/retrodeck/", "which-pack/"), 1),
|
||||
|
||||
Reference in new issue
Block a user