Mroonga blog

2017-08-29

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.

Mroonga 7.06 has been released!

Changes

Here are changes 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.

Conclusion

See Release 7.06 - 2017-08-29 about detailed changes since 7.05.

Let's search by Mroonga!