DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:elasticsearch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revision
plugin:elasticsearch [2019-07-26 08:52]
Aleksandr
plugin:elasticsearch [2021-06-10 23:50]
andi version upped
Line 6: Line 6:
 email      : dokuwiki@cosmocode.de  email      : dokuwiki@cosmocode.de 
 type       : action type       : action
-lastupdate : 2019-07-25 +lastupdate : 2021-06-10 
-compatible : Greebo+compatible : Greebo, Hogfather
 depends    :  depends    : 
 conflicts  conflicts 
Line 13: Line 13:
 tags       : search tags       : search
  
-downloadurl: http://github.com/cosmocode/dokuwiki-plugin-elasticsearch/zipball/master +downloadurl: https://github.com/cosmocode/dokuwiki-plugin-elasticsearch/zipball/master 
-bugtracker : http://github.com/cosmocode/dokuwiki-plugin-elasticsearch/issues +bugtracker : https://github.com/cosmocode/dokuwiki-plugin-elasticsearch/issues 
-sourcerepo : http://github.com/cosmocode/dokuwiki-plugin-elasticsearch/+sourcerepo : https://github.com/cosmocode/dokuwiki-plugin-elasticsearch/
 donationurl:  donationurl: 
  
Line 26: Line 26:
  
 :!: **External requirements:** This plugin requires the following additional components that must be installed separately:  :!: **External requirements:** This plugin requires the following additional components that must be installed separately: 
-  * [[https://www.elastic.co/products/elasticsearch|Elasticsearch]] instance (latest supported version 7.1)+  * [[https://www.elastic.co/products/elasticsearch|Elasticsearch]] instance (latest supported version 7.11)
  
 Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually. Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually.
Line 38: Line 38:
 All [[acl|access rights]] are respected, so users will only find pages for which they have at least read privileges. All [[acl|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. +You can use the Advanced Search Tools to filter the results by namespace and date of the last modification.
  
 +If the [[plugin:text|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.
 ===== Configuration and Settings ===== ===== Configuration and Settings =====
  
-To integrate this plugin, you will need to dp some configuration and run a few commands on the command line. +To integrate this plugin, you will need to do some configuration and run a few commands on the command line. 
  
   - enter the configuration of your Elasticsearch server in the [[plugin:config|Configuration Settings]]   - enter the configuration of your Elasticsearch server in the [[plugin:config|Configuration Settings]]
Line 59: Line 60:
 The name of the index is determined by the configuration. The name of the index is determined by the configuration.
  
 +=== Re-creating the index ===
 +
 +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:
 +
 +<code>
 +./bin/plugin.php elasticsearch createindex --clear
 +</code>
 ==== Languages and fuzzy search ==== ==== Languages and fuzzy search ====
  
Line 69: Line 77:
 If you have configured multiple languages using the [[plugin:translation|Translation plugin]], they will be mapped as well. If you have configured multiple languages using the [[plugin:translation|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 onlyHoweverit is possible to filter the results by language namespaces.+By default all available translation are searched. Users can change the language selection in Advanced Search Tools. 
 + 
 +You can also enable translation detection in the plugin configuration. The option is called ''detectTranslation''. When activated, the search will try to detect the current language context from the top namespace, and then set the language filter accordinglyFor exampleif the translation plugin is configured to handle the ''en es fr'' namespaces and the user starts the search when browsing the page ''es:capítulos:tres'', the language filter will be automatically set to ''es''.
  
 ==== Index management ==== ==== Index management ====
Line 80: Line 90:
 ./bin/plugin.php elasticsearch index ./bin/plugin.php elasticsearch index
 </code> </code>
 +
 +===== Other plugins =====
 +
 +The [[plugin:tagging|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.
  
 ===== Development ===== ===== Development =====
 +
 +==== Plugin integration ====
 +
 +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 [[plugin:tagging|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.
  
 ==== Commit-Ticker ==== ==== Commit-Ticker ====
Line 94: Line 118:
   * search a specific language   * search a specific language
   * exact match (non-fuzzy search)   * exact match (non-fuzzy search)
-  * integration of the [[plugin:tagging]] plugin; tagged pages are shown on the results page but this bypasses Elasticsearch 
  
  
plugin/elasticsearch.txt · Last modified: 2021-06-13 14:21 by michaelsy