Skip to content

Instantly share code, notes, and snippets.

@yoku0825
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoku0825/8821138 to your computer and use it in GitHub Desktop.
Save yoku0825/8821138 to your computer and use it in GitHub Desktop.
mysql> DROP DATABASE IF EXISTS mroonga;
Query OK, 0 rows affected (0.02 sec)
mysql> CREATE DATABASE mroonga;
Query OK, 1 row affected (0.00 sec)
mysql> use mroonga;
Database changed
mysql> CREATE TABLE mroonga.norm_auto (num int unsigned not null, val varchar(32) not null, PRIMARY KEY(num), FULLTEXT KEY(val) Comment 'normalizer "NormalizerAuto"') Engine= mroonga;
Query OK, 0 rows affected (0.12 sec)
mysql> INSERT INTO mroonga.norm_auto VALUES (1, 'yoku0825!'), (2, 'yoku0825!');
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> CREATE TABLE mroonga.norm_unicode (num int unsigned not null, val varchar(32) not null, PRIMARY KEY(num), FULLTEXT KEY(val) Comment 'normalizer "NormalizerMySQLGeneralCI"') Engine= mroonga;
Query OK, 0 rows affected (0.10 sec)
mysql> INSERT INTO mroonga.norm_unicode VALUES (1, 'yoku0825!'), (2, 'yoku0825!');
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> CREATE TABLE mroonga.norm_voiced (num int unsigned not null, val varchar(32) not null, PRIMARY KEY(num), FULLTEXT KEY(val) Comment 'normalizer "NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark"') Engine= mroonga;
Query OK, 0 rows affected (0.11 sec)
mysql> INSERT INTO mroonga.norm_voiced VALUES (1, 'yoku0825!'), (2, 'yoku0825!');
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> SELECT * FROM mroonga.norm_auto WHERE MATCH(val) AGAINST('0825' IN BOOLEAN MODE);
+-----+-------------+
| num | val |
+-----+-------------+
| 1 | yoku0825! |
| 2 | yoku0825! |
+-----+-------------+
2 rows in set (0.00 sec)
mysql> SELECT * FROM mroonga.norm_unicode WHERE MATCH(val) AGAINST('0825' IN BOOLEAN MODE);
+-----+-------------+
| num | val |
+-----+-------------+
| 1 | yoku0825! |
| 2 | yoku0825! |
+-----+-------------+
2 rows in set (0.00 sec)
mysql> SELECT * FROM mroonga.norm_voiced WHERE MATCH(val) AGAINST('0825' IN BOOLEAN MODE);
+-----+-----------+
| num | val |
+-----+-----------+
| 1 | yoku0825! |
+-----+-----------+
1 row in set (0.00 sec)
mysql> SELECT mroonga_command('select norm_auto-val');
+-----------------------------------------------------------------------------------------------------------+
| mroonga_command('select norm_auto-val') |
+-----------------------------------------------------------------------------------------------------------+
| [[[3],[["_id","UInt32"],["_key","ShortText"],["index","norm_auto"]],[3,"!",6],[2,"0825",5],[1,"yoku",4]]] |
+-----------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
mysql> SELECT mroonga_command('select norm_unicode-val');
+--------------------------------------------------------------------------------------------------------------------------+
| mroonga_command('select norm_unicode-val') |
+--------------------------------------------------------------------------------------------------------------------------+
| [[[4],[["_id","UInt32"],["_key","ShortText"],["index","norm_unicode"]],[3,"!",1],[2,"0825",5],[1,"YOKU",4],[4,"!",1]]] |
+--------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
mysql> SELECT mroonga_command('select norm_voiced-val');
+---------------------------------------------------------------------------------------------------------------------------+
| mroonga_command('select norm_voiced-val') |
+---------------------------------------------------------------------------------------------------------------------------+
| [[[4],[["_id","UInt32"],["_key","ShortText"],["index","norm_voiced"]],[3,"!",1],[2,"0825",1],[4,"0825!",1],[1,"YOKU",4]]] |
+---------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment