Skip to content

Search

A wiki nobody can find things in is a filing cabinet with the lights off. BookStack's search is plain and effective: it indexes the text of shelves, books, chapters and pages, and the search box at the top of every page searches all of it at once.

The lab's test

Before the search chapter could be written, it had to be proven. The lab planted a distinctive word — pluviometer (the instrument that measures rainfall) — in the body of the pumpkins page, a word that appears nowhere in any title. A search for it returned exactly one result: Storing Pumpkins for Winter, found by its contents, not its name. That is the behaviour the rest of this chapter assumes and your own install will match: search reads the text, not just the titles.

Searching well

  • Search from anywhere. The top bar's search box searches everything you are allowed to see. The full search page adds filters — by type (pages, books, chapters, shelves), by who created or updated, by date — for the day the simple search returns a crowd.
  • Exact phrases can be quoted, and terms can be excluded, in the full search; the syntax is documented upstream and worth the five minutes when your library gets big.
  • Tags are searchable too. Shelves, books, chapters and pages can carry name/value tags, and a consistent tagging habit (say, status = reviewed) turns search into a reporting tool.

Search respects the fences

Search never leaks what you cannot see. Chapter 8 fences the Seed Orders and Accounts book away from the lab's reader account; that account's searches behave as if the book does not exist — no titles in results, no counts that hint. When you test your own permissions, test search as the restricted user, not just the menus: it is the leak people forget to check, and in BookStack it holds.

Writing pages that get found

Search can only find the words you wrote. Three habits, all cheap:

  1. Title pages the way readers ask. Storing Pumpkins for Winter is found by someone searching any of those words.
  2. Say the thing plainly in the text. The synonym in the body — the pluviometer trick in reverse — is what rescues the searcher who used the other word for it.
  3. Write the descriptions. Shelf, book and chapter descriptions are searched and shown in results; a good one-sentence description is a signpost that works forever.

Check: as an admin, plant an unusual word in a low page's body, search for it, then repeat the search as a restricted user whose permissions exclude that page. Found the first time, absent the second — that is the whole contract, working.