Mroonga blog

2012-09-29

Mroonga 2.07 has been released!

Mroonga 2.07 has been released!

Mroonga is a MySQL storage engine that supports fast fulltext search and geolocation search. It is CJK ready. It uses groonga as a storage and fulltext search engine.

How to install: Install

This release has a backward compatibility about database.

There are two topics for this release:

  • Supported experimental snippet function
  • Enabled AppArmor configuration for MeCab

Supported experimental snippet function

Tritonn project which is ancestor of mroonga had provided snippet UDF which extract keyword and surrounding text.

This release began to support mroonga_snippet function which provides similar functionality like snippet UDF.

Note that this feature is experimental.

Here is the syntax about mroonga_snippet function:

  SELECT mroonga_snippet(document, max_length, max_count, encoding,
    skip_leading_spaces, escape, snippet_prefix, snippet_suffix, 
    word1, word1_prefix, word1_prefix,
    word2, word2_prefix, word2_prefix, ...);

We show how to use above experimental feature.

The theme is "Searching the document which contains 'fulltext' as a keyword, then if the document contains 'MySQL' or 'search', extract matched keyword and surrounding text".

The solution is using the mroonga_snippet function and MATCH ... AGAINST syntax.

Confirm following the schema definitions, the sample data and the execution example.

Here is the schema defintions:

  CREATE TABLE `snippet_test` (
    `id` int(11) NOT NULL,
    `text` text,
    PRIMARY KEY (`id`),
    FULLTEXT KEY `text` (`text`)
  ) ENGINE=mroonga DEFAULT CHARSET=utf8

Here is the sample data:

  insert into snippet_test (id, text) values (1, 'An open-source fulltext search engine and column store.');
  insert into snippet_test (id, text) values (2, 'An open-source storage engine for fast fulltext search with MySQL.');
  insert into snippet_test (id, text) values (3, 'Tritonn is a patched version of MySQL that supports better fulltext search function with Senna.');

Here is the results of execution examples:

  mysql> select * from snippet_test;
  +----+-------------------------------------------------------------------------------------------------+
  | id | text                                                                                            |
  +----+-------------------------------------------------------------------------------------------------+
  |  1 | An open-source fulltext search engine and column store.                                         |
  |  2 | An open-source storage engine for fast fulltext search with MySQL.                              |
  |  3 | Tritonn is a patched version of MySQL that supports better fulltext search function with Senna. |
  +----+-------------------------------------------------------------------------------------------------+
  3 rows in set (0.00 sec)

  mysql> select id, mroonga_snippet(text, 8, 2, 'ascii_general_ci', 1, 1, '...', '...', 
           'fulltext', '', '', 
           'MySQL', '', '', 
           'search', '', '') 
           from snippet_test where match(text) against ('fulltext');

  +----+-------------------------------------------------------------------------------------+
  | id | (...ommited about query...)                                                         |
  +----+-------------------------------------------------------------------------------------+
  |  1 | ...fulltext...... search ...|
  |  2 | ...fulltext...... search ...|
  |  3 | ...f MySQL ......fulltext...|
  +----+-------------------------------------------------------------------------------------+
  3 rows in set (0.00 sec)

As you can see, by using with MATCH ... AGAINST syntax, you can extract the parts which contains not only 'fulltext' keyword, but also 'MySQL' or 'search'.

See How to get snippet (Keyword in context) about mroonga_snippet function.

Enabled AppArmor configuration for MeCab

There was no configuration setting for AppArmor about the dictionary of MeCab.

If you use AppArmor introduced in Ubuntu, there is a case that mysqld can not access the dictionary of MeCab.

We have added AppArmor configuration for MeCab as it is incovenience for mroonga user.

Conclusion

See Release 2.07 - 2012/09/29 about detailed changes since 2.06.

Let's search by mroonga!