DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:searchtext

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
plugin:searchtext [2010-10-09 18:56] gturriplugin:searchtext [2023-09-02 20:33] (current) – Similar to elasticsearch, docsearch michaelsy
Line 1: Line 1:
-====== searchtext plugin ======+====== SearchText Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: Searches pages rendered as text instead of raw wiki. Displays search result snippets from rendered text. +description: Searches pages rendered as text instead of raw wiki. Displays search result snippets from rendered text. (Original author: Todd Augsburger
-author     : Todd Augsburger +author     : Michael Hamann 
-email      : todd@rollerorgans.com +email      : michael@content-space.de 
-type       : action, render +type       : action 
-lastupdate : 2008-02-28 +lastupdate : 2015-04-19 
-compatible : devel >2008-02-28with modification+compatible : Hogfather, Greebo, Frusterrick Manner, Elenor of TsortDetritus 
 depends    : text depends    : text
-conflicts  :  +conflicts sqlite 
-similar    : +similar    : elasticsearch, docsearch
 tags       : search tags       : search
-downloadurl: http://cobs.rollerorgans.com/plugins/searchtext.zip+downloadurl: https://github.com/michitux/dokuwiki-plugin-searchtext/tarball/master 
 +bugtracker : https://github.com/michitux/dokuwiki-plugin-searchtext/issues 
 +sourcerepo : https://github.com/michitux/dokuwiki-plugin-searchtext/ 
 +donationurl: 
 ---- ----
  
Line 18: Line 21:
 This plugin displays search result snippets from text. This plugin displays search result snippets from text.
  
-:!: This plugin **requires**+:!: This plugin **requires** text renderer, such as the [[plugin:text]] plugin
-    -A text renderer, such as the [[plugin:text]] plugin +
-    -A slight modification to add a FULLTEXT_SNIPPET_GETTEXT event to inc/fulltext.php if you wish to use the snippet capability //(see below)// +
- +
-:!: You will need a recent [[devel:develonly|development version]] of DokuWiki to make this work! +
- +
-===== Download ===== +
- +
-  * [[http://cobs.rollerorgans.com/plugins/searchtext.zip]] -- 2008-02-29, metadata bug fix, simplified event +
-  * 2008-02-28, initial upload+
  
 ===== Usage ===== ===== Usage =====
  
-There are two checkbox configuration items which appear at the bottom of the **Admin Configuration Settings**:+There are two checkbox configuration items which appear in the bottom area of the **Admin Configuration Settings**:
   -Search in rendered text   -Search in rendered text
   -Display search result snippets from rendered text   -Display search result snippets from rendered text
  
-You __must__ edit the function [[xref>ft_snippet()]] in **../inc/fulltext.php** in order to provide a FULLTEXT_SNIPPET_GETTEXT event if you wish to use the snippet capability. A sample darcs patch would be: 
-<code> 
- 
-[Allow plugin to insert search snippet text 
-Todd Augsburger <todd@rollerorgans.com>**20080227000001 
- FULLTEXT_SNIPPET_GETTEXT 
- Allow plugin to insert search snippet text 
-] { 
-hunk ./inc/fulltext.php 254 
--    $text     = rawWiki($id); 
-+    $text = trigger_event('FULLTEXT_SNIPPET_GETTEXT', $id, 'rawWiki');  
-} 
- 
-</code> 
- 
-Actual row in code may vary, for //DokuWiki 2009-02-14// it's row 289. 
- 
-===== Other plugins ===== 
-This plugin requires a text renderer, such as [[plugin:text]], available at http://cobs.rollerorgans.com/plugins/text.zip 
 ===== Discussion ===== ===== Discussion =====
  
-The [[devel:develonly]] version already has a similar event, so then it's better to patch the plugin. +:!: Please report any bugs on the [[https://github.com/michitux/dokuwiki-plugin-searchtext/issues|issue tracker]], feel free to send pull requests.
- +
-Replace +
-<code php> +
-  function register(&$controller) { +
-    $controller->register_hook('INDEXER_PAGE_ADD', 'BEFORE',  $this, '_getSearch'); +
-    $controller->register_hook('FULLTEXT_SNIPPET_GETTEXT', 'BEFORE',  $this, '_getSnippet'); +
-  } +
- +
-    . +
-    . +
-    . +
-     +
-  function _getSnippet(&$event, $param) { +
-    if($this->getConf('snippet_in_text')) { +
-      global $ID; +
- +
-      $prevID = $ID; +
-      $ID = $event->data; +
-      $event->result = p_cached_output(wikiFN($event->data),'text'); +
-      $ID = $prevID; +
-      $event->preventDefault(); +
-    } +
-  } +
-</code> +
- +
-with +
-<code php> +
-  function register(&$controller) { +
-    $controller->register_hook('INDEXER_PAGE_ADD', 'BEFORE',  $this, '_getSearch'); +
-    $controller->register_hook('FULLTEXT_SNIPPET_CREATE', 'BEFORE',  $this, '_getSnippet'); +
-  } +
- +
-    . +
-    . +
-    . +
-     +
-  function _getSnippet(&$event, $param) { +
-    if($this->getConf('snippet_in_text')) { +
-      global $ID; +
- +
-      $prevID = $ID; +
-      $ID = $event->data['id']; +
-      $event->result = p_cached_output(wikiFN($event->data['id']),'text'); +
-      $ID = $prevID; +
-      $event->preventDefault(); +
-    } +
-  } +
-</code> +
- --- //[[hakan.sandell@home.se|HåkanS]] 2009/10/30 17:49// +
- +
-The latest DokuWiki (DokuWiki-2009-12-25c) works unmodified with the following _getSnippet(): +
-<code php> +
-  function register(&$controller) { +
-    $controller->register_hook('INDEXER_PAGE_ADD', 'BEFORE',  $this, '_getSearch'); +
-    $controller->register_hook('FULLTEXT_SNIPPET_CREATE', 'BEFORE',  $this, '_getSnippet'); +
-  } +
- +
-  function _getSnippet(&$event, $param) { +
-    if($this->getConf('snippet_in_text')) { +
-      global $ID; +
-      $prevID = $ID; +
-      $ID = $event->data['id']; +
-      $event->data['text'] = p_cached_output(wikiFN($event->data['id']),'text'); +
-      $ID = $prevID; +
-    } +
-  } +
-</code> +
- --- //[[hans@hpelbers.org|Hansel]] Mon Jan 25 11:09:18 CET 2010// +
- +
-To make the modification above work properly you have to delete the old index and metadata: in <dokukiki>/data +
-  sudo rm -rf cache/* meta/* index/* +
- +
- --- //[[hans@hpelbers.org|Hansel]] Tue Jan 26 08:12:59 UTC 2010// +
-[[cli|Howto recreate the indexes]] +
plugin/searchtext.1286643377.txt.gz · Last modified: 2010-10-09 18:56 by gturri

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki