Repository navigation
Conversation
…l name Forever names are "First Surname", and every character search matched only the start of the first name, so "Morningstar" or "Volvik Morningstar" never found Volvik Morningstar. - New migration redefines armory_search to match the start of the first name, the surname or "first surname" (trimmed, lower case, any run of spaces as one), with text_pattern_ops indexes on the surname and the full name. Hide rule, wildcard refusal, minimum length, order, cap and the service-role-only grant are unchanged. - The header and /search people search now include armory characters with their region, alongside the addon's players rows, one row per page. The /armory hub accepts a full name. - The /search/people answer types move to their own module, so the browser components and the export scripts never import the armory store. Part of #1270. Signed-off-by: CDVolvik <cjimenez@r21digital.com>
|
Summary: This PR implements full-name character search in the armory by adding new database indexes and a PL/pgSQL function that matches first names, surnames, or full names. The web UI is updated to support surname/full name searches in both the header search box and /armory hub, with proper integration into the people search results. Key risks include potential performance issues from the new LIKE operations and the need for the migration to be applied before the web changes take effect. Standards
Spec Checked
R21 rulebook review |
Signed-off-by: CDVolvik <cjimenez@r21digital.com>
6 of 7 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1270 (proposal item 1, the search fix).
What changed
Forever names are "First Surname", and every character search matched only the start of the first name. "Morningstar" or "Volvik Morningstar" could never find Volvik Morningstar.
New migration
supabase/migrations/20261117140000_armory_full_name_search.sqlredefinesarmory_search. A query now matches the start of the first name, the surname, or "first surname". It is trimmed and lower cased, and any run of spaces counts as one. The migration addstext_pattern_opsindexes onlower(surname)andlower(name || ' ' || surname); the first name already had one. The function is now PL/pgSQL, so eachLIKEgets its pattern at plan time and can use its prefix index. These rules are unchanged: thearmory_hidesfilter, the 2-character minimum, the refusal of%,_and\, the order, the 100-row cap, the security-definer settings and the service-role-only grant. Same signature and same columns, so no caller changes are needed. The migration replaces one function and adds two indexes; it touches no table or row. It is safe to apply twice, and the rollback is at the bottom of the file.playersis left as it is, on purpose. Its rows are first-name sightings with no surname column.upsert_players_armorysends every full identity to the armory instead ("never collapse them into a first-name sighting"). Sosearch_playershas no surname to match, and it already hasplayers_name_prefix (name_key text_pattern_ops). A full-name query reads only the armory.Header and /search people search (
web/src/lib/people-search.ts) now add armory characters (whenEVERLOOT_ARMORY=1) to the existing players rows, in one Characters group:Level 31 Warrior · US PvP(region and ruleset)PEOPLE_LIMITof 8, same 25-row lookup capThe armory lookup is not cached, so an armory hide applies to the very next search.
The header box's
couldBeNamepre-filter now passes a surname of up to 24 letters or a full name. Before, a long full name never reached /search/people.The /armory hub search box accepts a surname or a full name. The guild box is unchanged.
The
PeopleSearch/PersonGroup/PersonResulttypes moved toweb/src/lib/people-search-types.ts, andpeople-search.tsre-exports them. Without this,SearchBar.tsx(a type-only import) put the armory store on the import graph ofweb/scripts/export-bulk.ts, andkb/test/armory-isolation.test.tscorrectly failed.Must be applied by the maintainer: the migration is not applied anywhere. Until it is applied, the web change degrades safely: the old
armory_searchreturns no rows for a surname or a full name. No error is thrown, and the first-name search behaves as it does today.Not in this PR (later items of #1270): the on-demand Blizzard lookup when a search misses, the discovery crawl fixes, and the character sheet tabs. Until the crawl fills the armory (347 characters, none on PvP as of the issue), this fix only finds characters already stored.
How you tested it
SQL on PGlite (
kb/test/armory-search-sql.test.ts): applies the armory migrations plus the new one (twice), then runssupabase/tests/armory_search.sqlandsupabase/tests/armory.sql. The tests check that:EXPLAINshows each part using its prefix indexMutation check: without the new migration the test fails with
us miss for Morningstar.Web unit tests:
people-search.test.ts: the four required queries plus extra spacing find "Volvik Morningstar" with its region; a hidden character is not returned; players and armory rows merge with no duplicates and keep the limit; an armory failure leaves the players rowssearch-bar.test.tsx:couldBeNamearmory.test.tsx: the hub finds a character by surname and by full namecd web && npx vitest run --maxWorkers=4 --testTimeout=60000: 5951 passed, 2 failed, 30 skipped (522 files). The 2 failures are the known Windowsscripts/build-version.test.tsspawnSync npm ENOENTcases.cd web && npm run typecheck: clean.npm run lint: 4 warnings, all in files this PR doesn't touch.cd kb && npm test: 2187 passed, 1 skipped (183 files).npm run typecheck: clean.next buildwas not run, because no route export or route config changed.The title reads
type(scope): plain sentenceCommits are signed off
No scraped, datamined or spoiler data; all fixtures are invented names
For an addon change: n/a
CHANGELOG.mdhas one line under[Unreleased](### Fixed,Site:)The area label is set
Docs are updated if behaviour changed (migration header and code comments)