MariaDBã«Mroongaã¯ãã³ãã«ããã¦ãã¾ããã Tokenizerã¨ãã¦Mecabã使ãéã¯ãå°ã注æãå¿ è¦ã§ãã å ¬å¼ã«ã¯ã以ä¸ã®ããã«æ¸ããã¦ãã¾ãããæé ãæ®ãã¦ããã¾ãã https://mariadb.com/kb/en/library/mroonga-overview/ ãTokenise using MeCab. Required Groonga to be buillt with MeCab support.ã ãªããOSã¯CentOS7ãMariaDBã®ãã¼ã¸ã§ã³ã¯ã10.3.8ã§ãã ã¾ãã¯ããã³ãã«ããã¦ããMroongaã®ã¤ã³ã¹ãã¼ã«ãè¦ã¦ããã¾ãã å ¬å¼ï¼https://mariadb.com/kb/en/library/about-mroonga/ï¼ãåèã«ãã¦ãã¾ãã ï¼ï¼ãã©ã°ã¤ã³ã®ã¤ã³ã¹ãã¼ã« MariaDB [(none)]> show eng
ãããã¯ãã«æ¥æ¬èªã®å ¨ææ¤ç´¢æ©è½ãå ããããæ¤ç´¢ã¤ã³ããã¯ã¹ã®ãªã¢ã«ã¿ã¤ã æ´æ°ãã»ãã ã¨ããã¨ãã®æ軽ãªæ¹æ³MySQLæ¤ç´¢InnoDBå ¨ææ¤ç´¢mysql5.7 ãããã¯ããªã¼ãã¼ ã ã¦ã¼ã¶ããã®è¦æã«ãã£ã¦ æ¤ç´¢æ©è½ ã®å¿ è¦æ§ã«è¿«ãããã¨ãã ãããµããæ¹æ³ ã§ã㤠éæ» ã§å®è£ ããæ¹æ³ã§ã è¦ä»¶ æ¥æ¬èªæç« ãªã©ã®ãã¼ã¿ã«å¯¾ãã¦ãå ¨ææ¤ç´¢ã§ãã æ¤ç´¢ãªã¯ã¨ã¹ãã«å¯¾ãã¦ãååé«éã«ã¬ã¹ãã³ã¹ãè¿ã æ¤ç´¢ã¤ã³ããã¯ã¹ã¯ãªã¢ã«ã¿ã¤ã æ´æ°ãããå®ãã¼ã¿ã¨ç¸éãã§ãªã æ¤ç´¢å¯¾è±¡ã®ãã¼ã¿ã追å ï¼æ´æ°ï¼åé¤ããããæ¤ç´¢çµæã«ãå³åæ ããã å¸æ ã§ããã ãéãå®è£ ï¼æä¾ããã ã§ããã ãéç¨ã³ã¹ããå°ããããã ãããããªæ¹æ³ ããããããã¯ããMySQLäºæã®ãã¼ã¿ãã¼ã¹ã使ã£ã¦ããããè¦ä»¶ãæºãã㦠ææ¥ã«ãæä¾ã§ãã ããããã¾ããï¼æ°æã¡ã§ããããã³ãå¨ãã®å®è£ ãªã©äºæ ã«ãã£ã¦å½ç¶ã³ã¹ãã
â» ãã®è¨äºã¯ä»¥åMediumã§å ¬éããè¨äº ã®è»¢è¼ã§ã MySQL5.7ã»InnoDBã»N-gram ã¨ããç°å¢ä¸ã§å ¨ææ¤ç´¢ã®æåãããã©ã¼ãã³ã¹ã«ã¤ãã¦æ¤è¨¼ãè¡ã£ããFULLTEXT INDEXã¯ä»¥åã¯MyISAMã§ããå©ç¨ã§ããªãã£ããã 5.6.4ããInnoDBã§ã®ãµãã¼ããå§ã¾ã£ã¦ããã InnoDBã®å ¨ææ¤ç´¢ã¯5.7ãç¹ã«5.7.6以éã§ããããCJKï¼ä¸å½èªã»æ¥æ¬èªã»éå½èªï¼ãN-gramã§æ¨æºãµãã¼ãããå§ãã CREATE TABLEæã§ç°¡åã«ãã¼ãµã¼ãæå®ã§ããæ§æã®ãµãã¼ãã è¨å®ãã¯ã¨ãªã®çµç«ã§èããªãã¨ãããªãäºãæ¸ã£ãäºã§å°å ¥éå£ãããªãä¸ãã£ã¦ããã â»4.1ã¨5.0ã§ãµã¼ãã¹å°å ¥çµé¨ãããç§ã®å人çãªæ¯è¼ææ³ã§ãã FULLTEXT INDEXãä»ã®INDEXã¨åæ§ã«ãã¼ã¿æ´æ°ã»åé¤ã®éã«INDEXã®rebuildãèµ°ãã®ã§æ´æ°æã®è² è·ã«ã¯æ³¨æãå¿ è¦ã§ãF
tl;dr InnoDBã®å ¨ææ¤ç´¢èªä½ã¯é ããªã ãã ããã¼ã«å ¨ææ¤ç´¢ãè¡ãå¥é ç®ã§ã½ã¼ããè¡ãã¨ãã¨ããã«é ããªã LIMITã§åå¾ä»¶æ°ãçµã£ã¦ããã¾ãå¤ãããªã Mroongaã«ã¯å ¨ææ¤ç´¢ç¹åã®æé©åãããã¬ã¹ãã³ã¹ãæ©ãï¼ ãã¨ã®ã¯ãã¾ã å°å³ã«æºãã¦ããããã¹ãæ å ±ã1000ä¸ã¬ã³ã¼ããè¶ ããããããLIKEæ¤ç´¢ãéçãªã®ã§ãMySQL5.7ãã使ããããã«ãªã£ãMeCabãã©ã°ã¤ã³ã使ãå ¨ææ¤ç´¢æ©è½ãå®è£ ãã¦ã¿ã¾ãããå®è£ å½åã¯ããã¾ã§ã¬ã¹ãã³ã¹ãæªããªãã¨æã£ã¦ããã®ã§ããããããªãã®ã¬ã³ã¼ãæ°ã®ããã¯ã¼ããå ¥åããã½ã¼ãæ¡ä»¶ãæå®ããã¨ã½ã¼ããã¼ããã¨ãPKãã¤ã³ããã¯ã¹ãè²¼ããã¦ããã«ã©ã ã§ãåéã«ï¼(ããããï¼ãã¼ãã«ã«ä½¿ããã¤ã³ããã¯ã¹ã¯1ã¤ã¾ã§ã¨ããMySQLã®å¶ç´) å¥ã®æ¹æ³ããªãã模索ãã¦ããã¨ãããMroongaã¨ã³ã¸ã³ã®å ¨ææ¤ç´¢ã使ã£ã¦ã¿ããããæãã ã£ãã®ã§
ã¾ã æ¥æ¬èªå ¨ææ¤ç´¢ã§æ¶èãã¦ãã®ï¼ ãã®è¨äºã¯ InnoDB ã®ãã«ããã¹ãã¤ã³ããã¯ã¹ã§æ¥æ¬èª NGRAM ã®ç¶ãã§ãã 以éâã®è¨äºããååã®è¨äºãã¨å¼ç§°ãã¾ãã ä¾ã«ãã£ã¦å®é¨ãã¤ã¤è¨è¿°ãã¦ãã¾ããæ´åæ§ãå 容ã®ä¿è¨¼ã¯ã§ãã¾ããã æ¤è¨¼ã«ä½¿ã£ãã®ã¯ CentOS 7, mysql 5.7.9 ã§ãã ååã®è¨äºã¯ä½ããã¦ããã®ã 端çã«è¨ãã°ä¸è¨ã§ãã æååã ngram åãããã¡ã³ã¯ã·ã§ã³ãå®ç¾© å ¨ææ¤ç´¢ãããè¤æ°ã«ã©ã ãçµåã㦠ngram åããæååãæ ¼ç´ããã«ã©ã ãå®ç¾© ããªã¬ã¼ã§âã®ã«ã©ã ã« ngram åããæååãæ¾ãè¾¼ã ââã®ã«ã©ã ã«å¯¾ã㦠FULLTEXT INDEX ãå¼µã æ¤ç´¢æã« âââã®ã«ã©ã ã«å¯¾ã㦠MATCH AGAINST æ¤ç´¢ãè¡ããã¨ã§å ¨ææ¤ç´¢ ã¨ã¾ãè²ã ããã©ããã¨ããã¦ãã¾ãã ç¹ã«æ¬çã§ã¯ãªãããªã¬ã¼ã¨ãã¡ã³ã¯ã·ã§ã³ã®å®ç¾©ãå«ã my
MariaDBã«ã¯è¶ é«éãªå ¨ææ¤ç´¢ãå®ç¾ããMroongaã¹ãã¬ã¼ã¸ã¨ã³ã¸ã³ããã³ãã«ããã¦ãããã¨ãç¥ã£ã¦ãã¾ããï¼Mroongaã使ãã¨æ¥æ¬èªã ãã§ãªãã¢ã¸ã¢åã®è¨èªãå«ããã¹ã¦ã®è¨èªããµãã¼ãããè¶ é«éãªå ¨ææ¤ç´¢ã·ã¹ãã ãç°¡åã«ä½ããã¨ãã§ãã¾ããã©ãã ãç°¡åã«ä½ããã¨ãã§ãããç´¹ä»ãã¾ããRead less
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}