Hi,

Mroonga 7.06 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.

Document:
   http://mroonga.org/docs/

How to install: Install Guide
   http://mroonga.org/docs/install.html

How to upgrade: Upgrade Guide
   http://mroonga.org/docs/upgrade.html

Blog:
   http://mroonga.org/en/blog/2017/08/29/mroonga-7.06.html

Changes:
   http://mroonga.org/docs/news.html#release-7.06

Here is the topic in this release.

  * Generated Column has been supported

### Generated Column has been supported

In this release, Generated Column has been supported!

Here is the sample schema to use generated column.

    CREATE TABLE logs (
      id INT,
      record JSON,
      message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, 
'$.message')) STORED,
      FULLTEXT INDEX(message) comment 'tokenizer 
"TokenBigramSplitSymbolAlphaDigit"'
    ) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4;

As you can see, the partial value of `record` column is used as `message` 
column.

Then, you can do full text search against `message` column by the following 
query.

    > SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE);
    +------+-----------------------------------------+-----------+
    | id   | record                                  | message   |
    +------+-----------------------------------------+-----------+
    |    1 | {"level": "info", "message": "start"}   | "start"   |
    |    2 | {"level": "info", "message": "restart"} | "restart" |
    +------+-----------------------------------------+-----------+
    2 rows in set (0.02 sec)

You can also define `VIRTUAL` without actual data column.

    CREATE TABLE logs (
      id INT,
      record JSON,
      message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, 
'$.message')) VIRTUAL
    ) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4;
    
But note that `FULLTEXT INDEX(message)` is not supported yet.

Regards,


-- 
Kentaro Hayashi <haya...@clear-code.com>

Attachment: pgpesmZoNWTia.pgp
Description: PGP signature

Reply via email to