Using the CodeGen_MySQL_Plugin i have now been able to create my first working fulltext plugin: gzip_fulltext
gzip_fulltext will uncompress data that was compressed with MySQLs COMPRESS() function on the fly before passing it on to the default fulltext parser. Data that is not gzip compressed will be passed on 'as is'.
Update: there were some minor compile problems with yesterdays release, these have been corrected and th download link below fixed
The plugin needs to distinguish between compressed and uncompressed data as both the actual row data as also the search terms passed by MATCHES ... AGAINST(...) will be handed over to the plugin, and there is no way for the plugin to distinguish between the two cases (yet?).
So the following is now possible when using this plugin:
INSTALL PLUGIN gzip SONAME 'gzip_fulltext.so';
CREATE TABLE t (
doc CHAR(100) DEFAULT NULL,
FULLTEXT KEY `doc` (`doc`) WITH PARSER gzip
) ENGINE=MyISAM DEFAULT CHARSET latin1;
INSERT INTO t (doc) VALUES ('this is a fulltext parser test');
INSERT INTO t (doc) VALUES ('the meaning of life, universe and all the rest');
INSERT INTO t (doc) VALUES (COMPRESS('this text is compressed'));
SELECT doc FROM t WHERE MATCH(doc) AGAINST('parser');
SELECT doc FROM t WHERE MATCH(doc) AGAINST('compressed');
SELECT doc FROM t WHERE MATCH(doc) AGAINST(COMPRESSED('universe'));
The plugin specification file is available from PEAR CVS, the full source package generated from it can be downloaded here.
To compile the package you need a running current MySQL 5.1 installation. The actual configure, compile and installation steps are as usual:
./configure --with-mysql=/your/mysql/prefix
make
sudo make install
After that you can install and test the plugin as described above 