Introduction

In [a mail] to tavi-devel Mathew White proposed a patch for an enhanced search method.

The search function uses a MySQL [full-text index]. The search results include the full-text score and a short excerpt surrounding the matching term. When the search hits a full-text stop-word (e.g. and) or the full-text matches nothing, it falls back to the old search method.

Database changes

The pages table is changed to the following schema:

CREATE TABLE `pages` (
   `title` varchar(80) NOT NULL default '',
   `version` int(10) unsigned NOT NULL default '1',
   `time` timestamp(14) NOT NULL,
   `supercede` timestamp(14) NOT NULL,
   `mutable` set('off','on') NOT NULL default 'on',
   `username` varchar(80) default NULL,
   `author` varchar(80) NOT NULL default '',
   `comment` varchar(80) NOT NULL default '',
   `body` text,
   PRIMARY KEY  (`title`,`version`),
   FULLTEXT KEY `full` (`title`,`body`)
);

You can of course change an existing installation with CREATE FULLTEXT INDEX full ON pages (title, body);

Installation

The patch itself is attached to said email. Save it to a text file. Go to your Tavi installation directory and apply it with patch -p7 < /path/to/search.patch

Example

The patch is e.g. installed [here]. Sorry it's in German, but you can still search for test or something.