Improve search #42

Closed
opened 2026-10-14 22:27:29 +00:00 by Syndria98 · 9 comments
Owner

On the frontend, doing Ctrl + K searches for notes. Upgrade the search and make that it also searches everywhere, for actors, items and also maps

On the frontend, doing Ctrl + K searches for notes. Upgrade the search and make that it also searches everywhere, for actors, items and also maps
Syndria98 added the ai-ready label 2026-10-14 22:27:29 +00:00
Agent added the working label 2026-10-14 22:30:17 +00:00
Collaborator

Now let me look at an existing test that inspects component behavior (not just styles), to follow the testing conventions:

Now let me look at an existing test that inspects component behavior (not just styles), to follow the testing conventions:
Collaborator

Everything checks out. Now I'll rewrite TopSearchBar.vue to search notes, actors, items, and maps — opening each the same way the sidebar does:

Everything checks out. Now I'll rewrite `TopSearchBar.vue` to search notes, actors, items, and maps — opening each the same way the sidebar does:
Collaborator

SearchResult.vue has a potential bug that is now on the click path of all results: handleSelect references props, but the return value of defineProps is never assigned — clicking on any result will throw an exception. Let me make a minimal fix:

`SearchResult.vue` has a potential bug that is now on the click path of all results: `handleSelect` references `props`, but the return value of `defineProps` is never assigned — clicking on any result will throw an exception. Let me make a minimal fix:
Collaborator

Now the test, following the repo's source-reading test conventions:

Now the test, following the repo's source-reading test conventions:
Collaborator

All 113 tests pass. Let me confirm the new tests specifically ran and the frontend still builds:

All 113 tests pass. Let me confirm the new tests specifically ran and the frontend still builds:
Collaborator

No package manager or installed deps here (CI runs only node --test without installing), so I can't run a full Nuxt build. I'll at least syntax-check the extracted <script setup> blocks:

No package manager or installed deps here (CI runs only `node --test` without installing), so I can't run a full Nuxt build. I'll at least syntax-check the extracted `<script setup>` blocks:
Collaborator

All good. Final review of the change set:

All good. Final review of the change set:
Collaborator

Done. The Ctrl+K palette now searches the whole campaign, not just notes.

Changes

frontend/app/components/viewer/topbar/TopSearchBar.vue — the search itself:

  • Fetches all four entry lists scoped to the current campaign: /note/all (so notes nested in folders are searchable too, not just root notes), /actor/list, /item/list, /map/list — fetched in parallel, each failure-isolated.
  • One shared accent/case-insensitive normalizer matches notes by title and actors/items/maps by name; command actions keep matching through ActionRegistry.search.
  • Each result row shows its section's icon and label (the sidebar's book/user/box/map icons, campaigns.sections.* i18n keys — already present in en/es/ca).
  • Selecting a result (Enter or click, via one openResult dispatcher) opens it exactly the way the sidebar does:
    • note → push-note with its content (retrieved via /note/retrieve/:id, fixing notes that opened empty from search);
    • actor → replaces the open character_sheet window;
    • item → replaces the open item_sheet window;
    • map → anchors on the note container (clearing a floating map_viewer first);
    • action → executes as before.
  • The palette refetches every time it opens (Foundry syncs entries in the background) and drops the cached lists when the campaign changes.

frontend/app/components/viewer/topbar/SearchResult.vue — one-word adjacent fix: handleSelect referenced an unassigned props, so clicking any result threw; now const props = defineProps(...).

tests/search-everywhere.test.js (new) — 5 tests in the repo's source-reading style covering the four fetched lists, the per-type matching, the sidebar-equivalent open behavior, the shared Enter/click dispatcher, and per-type icons/labels (verifying the section labels exist in all three locales).

Verification

  • npm test at the repo root: 113/113 pass (including the 5 new ones).
  • Extracted <script setup> blocks of both components pass node --check. A full Nuxt build/dev run wasn't possible in this environment (no package manager / installed deps; the test workflow also runs dependency-free).
Done. The Ctrl+K palette now searches the whole campaign, not just notes. ## Changes **`frontend/app/components/viewer/topbar/TopSearchBar.vue`** — the search itself: - Fetches all four entry lists scoped to the current campaign: `/note/all` (so notes nested in folders are searchable too, not just root notes), `/actor/list`, `/item/list`, `/map/list` — fetched in parallel, each failure-isolated. - One shared accent/case-insensitive normalizer matches notes by title and actors/items/maps by name; command actions keep matching through `ActionRegistry.search`. - Each result row shows its section's icon and label (the sidebar's `book/user/box/map` icons, `campaigns.sections.*` i18n keys — already present in en/es/ca). - Selecting a result (Enter or click, via one `openResult` dispatcher) opens it exactly the way the sidebar does: - **note** → `push-note` with its content (retrieved via `/note/retrieve/:id`, fixing notes that opened empty from search); - **actor** → replaces the open `character_sheet` window; - **item** → replaces the open `item_sheet` window; - **map** → anchors on the note container (clearing a floating `map_viewer` first); - **action** → executes as before. - The palette refetches every time it opens (Foundry syncs entries in the background) and drops the cached lists when the campaign changes. **`frontend/app/components/viewer/topbar/SearchResult.vue`** — one-word adjacent fix: `handleSelect` referenced an unassigned `props`, so clicking any result threw; now `const props = defineProps(...)`. **`tests/search-everywhere.test.js`** (new) — 5 tests in the repo's source-reading style covering the four fetched lists, the per-type matching, the sidebar-equivalent open behavior, the shared Enter/click dispatcher, and per-type icons/labels (verifying the section labels exist in all three locales). ## Verification - `npm test` at the repo root: **113/113 pass** (including the 5 new ones). - Extracted `<script setup>` blocks of both components pass `node --check`. A full Nuxt build/dev run wasn't possible in this environment (no package manager / installed deps; the test workflow also runs dependency-free).
Collaborator

Implementation is ready for review: #45

Implementation is ready for review: https://git.aranroig.com/Syndria98/dragonroll/pulls/45
Agent added help wanted and removed working labels 2026-10-14 22:39:26 +00:00
Agent referenced this issue from a commit 2026-10-14 22:39:26 +00:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Syndria98/dragonroll#42