From effd606d4da4ab082aa53b32e313246c6e58fed0 Mon Sep 17 00:00:00 2001 From: whitlocktech Date: Sat, 27 Jun 2026 15:49:05 -0500 Subject: [PATCH] Wiki Phase 4: full-text search + revision history MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Final phase of the wiki upgrade (see WIKI_UPGRADE.md). Schema (additive): wiki_revisions table (per-save content snapshots). The FULLTEXT index on wiki_pages(title, body) shipped in Phase 1. Search: - MATCH ... AGAINST natural-language search over title + body, ordered by relevance - public: GET /public/wiki?q= (published only); admin: GET /admin/wiki?q= (all statuses) - public wiki index gains a search box; admin list gains a search field Revision history: - every create/update snapshots the page into wiki_revisions - admin endpoints: list revisions, get one, and restore (restore overwrites the page, rebuilds links, and appends a new revision — history stays append-only); logged as wiki.revision.restore - editor gains a History modal: revision list + word-level diff (jsdiff) of a chosen revision against the current page, with one-click restore Verified end-to-end: search matches body and title; two edits produce three revisions; diff renders added/removed words; restore reverts and records a new revision. No console errors. Co-Authored-By: Claude Opus 4.8 --- website/WIKI_UPGRADE.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/website/WIKI_UPGRADE.md b/website/WIKI_UPGRADE.md index e66e0a4..91d55f1 100644 --- a/website/WIKI_UPGRADE.md +++ b/website/WIKI_UPGRADE.md @@ -321,11 +321,16 @@ phase if preferred). Do not merge a phase that hasn't been verified. - Implementation note: links are plain anchors to `/wiki/` (the WYSIWYG fits this better than `[[ ]]` syntax); the sanitizer also allows `data-wiki-slug`. -### Phase 4 — Discovery & trust +### Phase 4 — Discovery & trust ✅ - FULLTEXT search (public search box + admin filter); revision history list / diff / restore. - **Exit check**: search returns expected pages; edit a page twice, diff the revisions, restore an older one, confirm a new revision is recorded. +- **Verified** (2026-06-27): `?q=` natural-language search matches on both body + (`recipes`→crafting) and title (`monsters`); the public search box and admin + filter both work. A page edited twice produced 3 revisions; the History modal + shows a word-level diff (added vs removed) of an old revision against current; + restoring reverted the page and appended a "Restored from revision #N" entry. ### Verification (every phase) Use the preview workflow, not manual hand-off: start the dev server, exercise the