DokuWiki Search and Indexing — Full-Text Search, Indexer, and Search Configuration
In this tutorial, you'll learn how DokuWiki's search system works, how the indexer processes page content, how to configure search options, and how to optimize search for wikis with thousands of pages.
What You'll Learn
- How the DokuWiki indexer works
- Full-text search capabilities and limitations
- Search syntax (phrases, wildcards, boolean operators)
- Configuring search behavior
- Running the indexer manually
- Search performance optimization
Why It Matters
Search is how users find content in a wiki with more than a few dozen pages. Even the best namespace organization cannot replace a good search. Understanding how DokuWiki's search works — and its limitations — helps you set user expectations and optimize the search experience for your users.
Real-World Use
A support team maintains a knowledge base with 800 articles. When a customer reports an issue, the support agent searches for related articles using keywords. DokuWiki's full-text search returns results from all namespaces. The agent finds the relevant article in seconds, resolves the issue, and adds a note linking the article to the customer issue. Search turns a large wiki into a useful tool.
Learning Path
flowchart LR A[Page Revisions] --> B[Search] B --> C[Categories] C --> D[ACL Basics] D --> E[User Management] E --> F[Advanced ACL]
How the Indexer Works
DokuWiki maintains a search index in data/index/. The index is a collection of files that map words to the pages where they appear.
data/index/
├── page.idx # List of all page IDs
├── word.idx # List of all words (stemmed)
├── index/ # Word-to-page mapping files
├── length.idx # Word frequency data
└── title.idx # Page titles
When a page is saved, the indexer:
- Reads the page content
- Strips wiki syntax
- Splits text into words
- Stems words (removes suffixes: "running" becomes "run")
- Removes stop words (common words like "the", "and", "is")
- Updates the index files with the word-to-page mapping
The index is updated incrementally — only changed pages are re-indexed.
Running the Indexer
The indexer runs automatically when pages are saved. You can also run it manually:
# Run the indexer from the command line
php bin/indexer.php
Indexer Options
# Re-index all pages (full rebuild)
php bin/indexer.php -f
# Index only a specific page
php bin/indexer.php -p projects:roadmap
# Index only the start page
php bin/indexer.php -p start
# Show help
php bin/indexer.php -h
A full rebuild is useful after bulk page imports or when index files are corrupted.
Triggering the Indexer via Web
You can trigger indexing by accessing the search page with a special parameter:
http://yourserver/wiki/search?q=test&do=reindex
This is useful when you do not have command-line access (e.g., shared hosting).
Search Syntax
DokuWiki supports basic search operators:
Simple Word Search
milestone
Returns all pages containing the word "milestone."
Phrase Search
"project roadmap"
Use double quotes to search for an exact phrase.
Boolean AND
milestone roadmap
Multiple words are combined with AND by default. Returns pages containing both "milestone" and "roadmap."
Boolean OR
milestone OR deadline
Returns pages containing either word.
Excluding Words
milestone -roadmap
Returns pages containing "milestone" but not "roadmap."
Wildcard
mile*
Returns pages containing words starting with "mile": milestone, mileage, milestone.
The wildcard only works as a suffix (mile*), not as a prefix (*stone).
Namespace-Specific Search
Search results include the namespace in the page title, making it easy to identify which namespace a result belongs to. You cannot search within a specific namespace using search syntax alone, but you can use the Advanced Search features of some templates.
Search Configuration
Configure search behavior in conf/local.php:
<?php
// Indexing settings
$conf['index_allow_spaces'] = 1; // Allow spaces in page IDs (not recommended)
// Search settings
$conf['fulltext'] = 1; // Enable full-text search (default)
$conf['search_nslimit'] = 0; // Limit search depth (0 = unlimited)
$conf['search_fragment'] = 0; // Show search result snippets (0=off, 1=on)
$conf['search_mangle'] = 1; // Mangle search query for better matching
Search Result Snippets
When $conf['search_fragment'] is enabled, search results show a snippet of the page content with the matching words highlighted:
Project Roadmap (projects:roadmap)
...updated **milestone** dates for Q3. The **milestone** completion...
Snippets help users find the right page without clicking through to each result.
Search Limitations
DokuWiki's search has some limitations to be aware of:
| Limitation | Explanation |
|---|---|
| No relevance ranking | Results are not ranked by relevance. They are listed alphabetically by page ID. |
| No fuzzy search | Misspelled words do not match. "Milestone" does not find "milestone." |
| No stemming control | Stemming is automatic. "Running" and "run" match the same index entry. |
| No search within specific namespace | All searches span the entire wiki. |
| No search operators in web UI | Advanced operators (AND, OR, wildcards) are available but not documented in the default UI. |
Improving Search Experience
Use Descriptive Page Titles
Page titles are indexed and appear in search results. A page titled "Installation Guide" is more searchable than "Setup."
Use Consistent Terminology
If you call a concept "milestone" in one page and "deadline" in another, users searching for "milestone" will not find the "deadline" page. Use consistent terminology across your wiki.
Link Related Pages
Search considers link text when ranking. If many pages link to a page with the text "see the roadmap," that page ranks higher for "roadmap."
Add a Search Plugin
The "Searchstatistics" plugin provides search analytics — it shows what users are searching for and what they click. This helps you identify content gaps.
Rebuilding the Index
If search stops working or returns incorrect results, rebuild the index:
# Delete existing index and rebuild
rm -rf data/index/*
php bin/indexer.php -f
On shared hosting, you can trigger a full rebuild by:
- Going to the Admin panel
- Clicking "Index" in the search section
- Clicking "Rebuild Index"
Search and ACL
DokuWiki respects ACL permissions in search results. Pages that a user does not have permission to read do not appear in their search results. This means the same search query can return different results for different users.
Common Mistakes
- Not running the indexer after bulk imports: If you import 100 pages via the filesystem, the index is not updated until the indexer runs. Search will not find those pages until indexing is triggered.
- Expecting Google-quality search: DokuWiki's search is basic — no relevance ranking, no fuzzy matching, no auto-complete. For large wikis, consider the Elasticsearch plugin for advanced search.
- Ignoring stop words: Common words like "the," "and," "for" are excluded from indexing. Searching for "the setup guide" effectively searches for "setup guide."
- Corrupting index files: If the indexer is interrupted (e.g., server crash during indexing), index files can be corrupted. Rebuild the index to fix this.
- Not using descriptive page titles: A page with ID
notesand no heading is hard to find via search. Always use descriptive headings as the first line of every page.
Practice Questions
- How does the DokuWiki indexer Process page content when a page is saved?
- What search syntax would you use to find pages containing both "installation" and "configuration" but not "Windows"?
- Why might search results differ between users on the same DokuWiki installation?
- Challenge: Create a script that analyzes search behavior on your wiki. The script should: list the 20 most common search terms (from a search log or by analyzing popular pages), identify pages with weak titles (no descriptive text in the first heading), suggest missing pages for common search terms that return no results, and recommend cross-links between pages that share common keywords. Test the script and implement at least 3 of its recommendations.
FAQ
Mini Project
Goal: Audit and optimize your wiki's search.
- Search for 5 terms that should return relevant results on your wiki
- Note any searches that return no results when they should
- Check if the indexer has run recently: look at
data/index/page.idxmodification time - Run the indexer manually (full rebuild) if needed
- Verify search results improve after indexing
- Enable search result snippets if they are not enabled
- Review page titles across your wiki — update any unhelpful titles
- Create a search tips page and link it from the sidebar
What's Next
Search helps users find content. Now learn how to use categories and tags to organize content across namespace boundaries.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro