Repository navigation
Add the wiki's own search: a port of the Knowledge Base engine - #55
Merged
Merged
Conversation
The live version of each article is kept as plain text in wiki_search_text and indexed by the backend chosen in the ACP: native, MySQL fulltext or PostgreSQL fulltext. /wiki/search shows the matches with highlighted snippets, the overview has a search box, and the index follows an article as it is saved, approved, set offline and deleted. The ACP page chooses the backend, switches the search on and off, and builds or deletes the index. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
bonelifer
added a commit
that referenced
this pull request
Oct 13, 2026
Step 2 of the wiki search: matching wiki articles now appear next to the results of phpBB's own search. The wiki's own search page came in with #55. - **The block.** A keyword search in phpBB's search, or from the header search box, shows a **Wiki (N)** block above the forum results. It lists the best matches with title, description, a marked snippet and date, and ends with a "View all N wiki articles" link to the wiki's search page. The forum results are not changed. It shows on the first page of results only, only for members who may read the wiki, and not for searches by author, within one topic, or the pre-made ones such as active topics. - **The option.** The advanced search has an "Also search the Wiki" box, ticked by default. An unticked box stays unticked through the pages of results. It uses the core search events and two template events, so no core file changes and no event request was needed. - **ACP.** Extensions > Wiki > Search has two new settings: show wiki matches in the board search (on or off), and the number of articles in the block (1 to 50, default 5). The results per page of the wiki's own search page is unchanged. All three backends are now listed on that page; the ones the database cannot run are shown greyed out and cannot be chosen. - **Migration.** One new migration adds the two settings. - **Shared service.** The wiki's search page and the block use one search-results service, so the page's own code got shorter. - **Fix in the ported backend.** On MySQL, the native backend reported a total of 1 for titles-only and text-only searches whatever matched, because the Knowledge Base's copy of the count query always counted one row. It now counts the way phpBB core does. The block also shows only when there are rows to show. - **Docs.** README updated. The finished search plan moves to `docs/TODO/archive/archive1.md` with a record of what was built and covered. The TODO files record the decisions made for move/rename, the starter-templates repository (name, packaging) and edit conflicts, and drop the questions the built features already settled. **Tests** - Unit tests: 256 tests, 563 assertions, all pass. The code sniffer passes on the whole extension. - A new 27-check browser test covers the option on the advanced search, the block above the forum results with highlighting and a matching count, the header search box, an unticked box and its pages, no block for author, topic and pre-made searches or when the wiki has no match, titles-only and text-only counts, the block size setting, a member without wiki read permission, and both ACP switches. The wiki's own search test (22 or 23 checks) was re-run too. Both pass on phpBB 3.3.19 and phpBB 4.0.0-a3-dev, each on SQLite, MySQL and PostgreSQL with the native backend, and with MySQL fulltext on MySQL and PostgreSQL fulltext on PostgreSQL. - Not covered locally: the Windows and MSSQL jobs that run in CI, and styles other than prosilver. - The same MySQL count bug exists in the Knowledge Base's copy of the backend. That is for a separate change in that repository. --- Investigated and written by [Claude](https://www.anthropic.com/claude) on behalf of William Jacoby ([bonelifer](https://github.com/bonelifer)). --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
The wiki gets its own search, ported from the Knowledge Base. This is step 1 of
docs/TODO/todo-forum-search-integration.md; step 2, a "Wiki (N)" block in phpBB's own search, is separate.wiki_search_text, that holds one plain-text row for the live version of each article (BBCode, links, templates, tables and categories reduced to the words in them). Only the live version is searched: older versions and edits waiting for approval are not./wiki/search, and a search box on the overview. Match all or any words, search titles only or text only, sort by last edit or title. Results show the title, description, a snippet with the words marked, and the date. It needs the wiki-read permission and phpBB's "Can use search", and follows the board's search switches.descr_match; without it, an article whose description repeats a word from its text had its whole index insert fail silently.Tests
Investigated and written by Claude on behalf of William Jacoby (bonelifer).