<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >MySQL fulltext parser plugin</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="mnoGoSearch 3.3.9 reference manual" HREF="index.html"><LINK REL="UP" TITLE="Miscellaneous" HREF="msearch-misc.html"><LINK REL="PREVIOUS" TITLE="Using mnoGoSearch as an embedded search library " HREF="msearch-lib.html"><LINK REL="NEXT" TITLE="Database schema" HREF="msearch-dbschema.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="mnogo.css"><META NAME="Description" CONTENT="mnoGoSearch - Full Featured Web site Open Source Search Engine Software over the Internet and Intranet Web Sites Based on SQL Database. It is a Free search software covered by GNU license."><META NAME="Keywords" CONTENT="shareware, freeware, download, internet, unix, utilities, search engine, text retrieval, knowledge retrieval, text search, information retrieval, database search, mining, intranet, webserver, index, spider, filesearch, meta, free, open source, full-text, udmsearch, website, find, opensource, search, searching, software, udmsearch, engine, indexing, system, web, ftp, http, cgi, php, SQL, MySQL, database, php3, FreeBSD, Linux, Unix, mnoGoSearch, MacOS X, Mac OS X, Windows, 2000, NT, 95, 98, GNU, GPL, url, grabbing"></HEAD ><BODY CLASS="sect1" BGCOLOR="#EEEEEE" TEXT="#000000" LINK="#000080" VLINK="#800080" ALINK="#FF0000" ><!--#include virtual="body-before.html"--><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" ><SPAN CLASS="application" >mnoGoSearch</SPAN > 3.3.9 reference manual: Full-featured search engine software</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="msearch-lib.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 12. Miscellaneous</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="msearch-dbschema.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="udmstemmer" ><SPAN CLASS="application" >MySQL</SPAN > fulltext parser plugin</A ></H1 ><P >Starting with the version 3.2.36 <SPAN CLASS="application" >mnoGoSearch</SPAN > offers a stemming plugin which is compatible with the <SPAN CLASS="application" >MySQL</SPAN > 5.1 <A HREF="http://dev.mysql.com/doc/refman/5.1/en/plugin-full-text-plugins.html" TARGET="_top" > pluggable fulltext parsers</A > interface.</P ><P >When <SPAN CLASS="application" >mnoGoSearch stemming plugin</SPAN > is used as a fulltext parser plugin, all words are normalized during <TT CLASS="literal" >INSERT</TT >, <TT CLASS="literal" >UPDATE</TT > and <TT CLASS="literal" >SELECT</TT > <ACRONYM CLASS="acronym" >SQL</ACRONYM > queries. This allows to find different grammatical forms of the same words. For example, the search front-end will try to find the word <TT CLASS="literal" >test</TT > whenever the words <TT CLASS="literal" >testing</TT > or <TT CLASS="literal" >tests</TT > or <TT CLASS="literal" >tested</TT > are given in the search query, and vice versa. When processing <TT CLASS="literal" >INSERT</TT > and <TT CLASS="literal" >UPDATE</TT > <ACRONYM CLASS="acronym" >SQL</ACRONYM > statements, <SPAN CLASS="application" >MySQL</SPAN > will put all words into the fulltext index in their normalized form. When processing a <TT CLASS="literal" >SELECT</TT > <ACRONYM CLASS="acronym" >SQL</ACRONYM > statement, the query words given in the <TT CLASS="literal" >MATCH</TT > operator are normalized again and then searched in the fulltext index. </P ><P >To enable support for <SPAN CLASS="application" >MySQL</SPAN > 5.1 fulltext parser plugin, <SPAN CLASS="application" >mnoGoSearch</SPAN > should be configured with <TT CLASS="literal" >--enable-mysql-fulltext-plugin</TT > option: </P ><PRE CLASS="programlisting" > ./configure --with-mysql --enable-mysql-fulltext-plugin make make install </PRE ><P >To install <SPAN CLASS="application" >mnoGoSearch stemming plugin</SPAN >, <TT CLASS="filename" >libmnogosearch.so</TT > must be copied or sym-linked into the <SPAN CLASS="application" >MySQL</SPAN > plugin directory. Also, you must have <TT CLASS="literal" >INSERT</TT > privileges for the <TT CLASS="literal" >mysql.plugin</TT > table to be able to run the <TT CLASS="literal" >INSTALL PLUGIN</TT > statement. </P ><PRE CLASS="programlisting" > cp /usr/local/mnogosearch/lib/libmnogosearch.so /usr/lib/mysql or ln -s /usr/local/mnogosearch/lib/libmnogosearch.so /usr/lib/mysql </PRE ><P >Before <SPAN CLASS="application" >mnoGoSearch stemming plugin</SPAN > can be used for a fulltext index, <TT CLASS="filename" >libmnogosearch.so</TT > must be loaded into <SPAN CLASS="application" >MySQL</SPAN > using the <A HREF="http://dev.mysql.com/doc/refman/5.1/en/install-plugin.html" TARGET="_top" > INSTALL PLUGIN</A > statement:</P ><PRE CLASS="programlisting" > INSTALL PLUGIN stemming SONAME 'libmnogosearch.so'; </PRE ><P >To unload <SPAN CLASS="application" >mnoGoSearch stemming plugin</SPAN >, use the <A HREF="http://dev.mysql.com/doc/refman/5.1/en/uninstall-plugin.html" TARGET="_top" > UNINSTALL PLUGIN</A > statement:</P ><PRE CLASS="programlisting" > UNINSTALL PLUGIN stemming; </PRE ><P >To create an index using <SPAN CLASS="application" >mnoGoSearch stemming plugin</SPAN >, specify the <TT CLASS="literal" >WITH PARSER</TT > clause in the fulltext index definition:</P ><PRE CLASS="programlisting" > CREATE TABLE my_table ( my_column TEXT, FULLTEXT(my_column) WITH PARSER stemming ); </PRE ><P >When the <TT CLASS="literal" >INSTALL PLUGIN</TT > statement is executed, <SPAN CLASS="application" >mnoGoSearch stemming plugin</SPAN > reads its configuration from the file <TT CLASS="filename" >stemming.conf</TT > in <SPAN CLASS="application" >MySQL</SPAN > <TT CLASS="filename" >datadir</TT >. The file <TT CLASS="filename" >stemming.conf</TT > supports these standard <SPAN CLASS="application" >mnoGoSearch</SPAN > commands: <B CLASS="command" ><A HREF="msearch-cmdref-affix.html" >Affix</A ></B >, <B CLASS="command" ><A HREF="msearch-cmdref-spell.html" >Spell</A ></B > and <B CLASS="command" ><A HREF="msearch-cmdref-minwordlength.html" >MinWordLength</A ></B >. </P ><P >An example of <TT CLASS="filename" >stemming.conf</TT > may look like this: <PRE CLASS="programlisting" > MinWordLength 2 Spell en latin1 american.xlg Affix en latin1 english.aff </PRE > </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > <P ></P ><UL ><LI ><P > <SPAN CLASS="application" >mnoGoSearch stemming plugin</SPAN > doesn't support <SPAN CLASS="application" >MySQL</SPAN > Boolean mode operators at the moment. </P ></LI ><LI ><P >Whenever <TT CLASS="filename" >stemming.conf</TT > is modified, all fulltext indexes using the plugin most likely need to be rebuilt using the <TT CLASS="literal" >REPAIR TABLE</TT > statement. Note that <SPAN CLASS="application" >myisamchk</SPAN > does not work on tables that use plugins for fulltext indexes. </P ></LI ><LI ><P > Only one <B CLASS="command" ><A HREF="msearch-cmdref-affix.html" >Affix</A ></B > and one <B CLASS="command" ><A HREF="msearch-cmdref-spell.html" >Spell</A ></B > commands can currently be specified in <TT CLASS="filename" >stemming.conf</TT > </P ></LI ><LI >Using files in character sets different from column character set is not supported yet. </LI ></UL > </P ></BLOCKQUOTE ></DIV ><P >Usage example: <PRE CLASS="programlisting" > mysql> INSTALL PLUGIN stemming SONAME 'libmnogosearch.so'; Query OK, 0 rows affected (0.06 sec) mysql> CREATE TABLE t(a TEXT, FULLTEXT(a) WITH PARSER stemming); Query OK, 0 rows affected (0.01 sec) mysql> INSERT INTO t VALUES('testing'),('tested'),('test'),('tests'),('tester'); Query OK, 5 rows affected (0.00 sec) Records: 5 Duplicates: 0 Warnings: 0 mysql> SELECT * FROM t WHERE MATCH a AGAINST('test' IN BOOLEAN MODE); +---------+ | a | +---------+ | testing | | tested | | test | | tests | | tester | +---------+ 5 rows in set (0.01 sec) mysql> SELECT * FROM t WHERE MATCH a AGAINST('testing' IN BOOLEAN MODE); +---------+ | a | +---------+ | testing | | tested | | test | | tests | | tester | +---------+ 5 rows in set (0.00 sec) </PRE > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="msearch-lib.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="msearch-dbschema.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Using <SPAN CLASS="application" >mnoGoSearch</SPAN > as an embedded search library <A NAME="AEN6732" ></A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="msearch-misc.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Database schema</TD ></TR ></TABLE ></DIV ><!--#include virtual="body-after.html"--></BODY ></HTML >