Learn about DokuWiki
Learn about DokuWiki
External requirements: This plugin requires the following additional components that must be installed separately:
Configure and setup the plugin as outlined under Configuration below.
Once installed, the plugin will automatically react on the ?do=search action, replacing DokuWiki's builtin search.
All access rights are respected, so users will only find pages for which they have at least read privileges.
You can use the Advanced Search Tools to filter the results by namespace and date of the last modification.
If the text plugin is installed, the rendered content of pages will be indexed in addition to raw wiki syntax. By default, search uses both fields. If you want to disable search in syntax, change the
searchSyntax setting in the plugin's configuration.
To integrate this plugin, you will need to do some configuration and run a few commands on the command line.
You can use the tools provided by ElasticSearch to create the index or simply run the provided command line tool to do so:
./bin/plugin.php elasticsearch createindex
The name of the index is determined by the configuration.
Sometimes it is necessary to throw away the old index and replace it with a new one. This can be done via the same DokuWiki script with an additional parameter:
./bin/plugin.php elasticsearch createindex --clear
One of the main reasons for using a dedicated search engine is that it provides advanced features, such as fuzzy search. To enable it, the pages must be indexed using a linguistic analyzer in the appropriate language. Make sure to create the language mapping using the CLI tool before filling the index.
./bin/plugin.php elasticsearch createlangmapping
If you have configured multiple languages using the Translation plugin, they will be mapped as well.
At present there is no special filter that would let the user search in a particular language only. However, it is possible to filter the results by language namespaces.
The pages will be indexed automatically when browsed, just like with the DokuWiki builtin mechanism. When a page is updated, its entry in the index will be updated as well.
You can also force indexing the whole Wiki at once using the CLI tool. This is recommended when you build the index for the first time or when you have made extensive changes (like moving pages or updating the ACLs).
./bin/plugin.php elasticsearch index
The tagging plugin integrates well with Elasticsearch. You can search for tags explicitly using
#sometag search terms. If any of the results are tagged, a tag filter will be added to Advanced Search Tools.
Elasticsearch emits several events that can be used by other plugins to put their own data into the search index. Take a look at the implementation tagging to see how those events can be used.
PLUGIN_ELASTICSEARCH_CREATEMAPPING: Triggered when creating the index. Plugins may add their own fields and mappings via event data.
PLUGIN_ELASTICSEARCH_INDEXPAGE: While indexing a page, plugins can provide their own data.
PLUGIN_ELASTICSEARCH_FILTERS: Adds search configurations provided by plugins.
PLUGIN_ELASTICSEARCH_SEARCHFIELDS: Lets plugins add their own fields to the list of search fields included in the Elastic query.
PLUGIN_ELASTICSEARCH_QUERY: Lets plugins append their data to the query string.