Misocaéçºãã¼ã ã®é»æã§ãã 10æããMisocaéçºã«åå ããã¦ããã ãã¦ãã¾ãã 好ããªè¨èªã¯OCamlãæè¿èå³ã®ãããããã¯ã¯å¹½éåã§ãã Rubyæ´ã¯åå¹´ãããã®åå¿è ãªã®ã§ããããã調ã¹ã¤ã¤æãã¦ãããã¤ã¤ãæ°ãããä»äºããã¦ãã¾ãã
ãã¦ãä¸éã¯ã¯ãªã¹ãã¹ã¨Ruby2.3.0ã§æ²¸ãç«ã£ã¦ãã¾ããããããªãã¨ã¯å ¨ãé¢ä¿ãªããéçºå宿ã®å ±åããããã¨æãã¾ãã
Misocaéçºãã¼ã ã§ã¯11æ5æ¥ã7æ¥ã«ãä¼æ±æ¸©æ³ã«ããå±±åæ 館ããã¸éçºå宿ã«è¡ã£ã¦ãã¾ããã ä»åã®éçºå宿ã§ã¯ãæ¥é æ°ã«ãªã£ã¦ãããã©æãä»ãããã¦ããªã課é¡ã解決ããããã¨ãç®æ¨ã«ã2ãã¼ã ã«åããã¦éçºãè¡ãã¾ããã ãã®è¨äºã§ã¯ããæ¤ç´¢æ©è½ãããè¯ãããããã¨ãç®çã«ããElasticsearchãã¼ã (é»æ, taiki-t)ã®ã¬ãã¼ããã¾ã¨ãã¾ãã çµµæåãã¼ã ã®ã¬ãã¼ãã¯ååã®è¨äºãã覧ãã ããã
ãã¼ã ã®ç®æ¨
Misocaã§ã¯æ¤ç´¢ãç´ æ´ãªæ¹æ³ã§è¡ã£ã¦ããã®ã§ããããã¼ã¿éã«å¯¾ãã¦ã¹ã±ã¼ã«ããªããæè»ãªæ¤ç´¢ãé£ãããã¨ãã£ã課é¡ãããã¾ããã ç¾ç¶ã§ã¯å¤§ããªåé¡ã¯ãªãã®ã§ãããä»å¾ã®ãã¨ãèãã¦ç¬ç«ããæ¤ç´¢ã¨ã³ã¸ã³ã«ä¹ãæããããã¨ãããã¨ã§Elasticsearchã¸ã®ç§»è¡ãè¡ãã®ããã¼ã ã®ç®æ¨ã§ãã Elasticsearchã¯ãªã¼ãã³ã½ã¼ã¹ã®æ¤ç´¢ã¨ã³ã¸ã³ã§ãã¹ã±ã¼ã«ããããããRESTçµç±ã§æä½ãã§ããããWebã·ã¹ãã ã«çµã¿è¾¼ã¿ãããããªã©ã¨ãã£ãç¹å¾´ãããã¾ãã 使ãæ¹ãªã©ã«ã¤ãã¦ã詳ããã¯Wantedlyããã®è¨äºããªã¹ã¹ã¡ã§ãã
ãããã ã«é²ãããããéçºå宿ã§ã®ä½æ¥å¯¾è±¡ã¯ãåçªã»ååãå ¥åããæã«åºã¦ãããã«ãã¦ã³ããã¯ã¹ãã«çµããã¨ã«ãã¾ããã 以ä¸ã®ã¹ã¯ãªã¼ã³ã·ã§ããã®é¨åã§ããã
1æ¥ç®
åå¤å±ãåºçºãã¦ãå¯å£«å·æ¥½åº§ãçµç±ãã¤ã¤æ²¼æ´¥ã«å¯ãéãã¾ãã ã深海éãé£ã¹ãããã¨ããmzpããã®ãªã¯ã¨ã¹ãã«ããã深海éãæ¡ã£ã¦ãããæ´»ããã丸ããã§æ¼é£ã
ãã®ã¹ãçãããã»çæ¡ãã³ãªã©ãæ®æ®µé£ã¹ãããªãçãããã®ãé£ã¹ããã¾ããã å人çã«ã¯ããããå ¥ãç±³ã¢ã¤ã¹ããæ®éã«ç¾å³ããã¦é¢ç½ãã£ãã§ãã
ãã®å¾ã¯ããè¿ãã«ãã深海水æ館ã§ãå ã»ã©é£ã¹ãéãçåã©ããªå§¿ã ã£ãã®ããå ªè½ãã¾ãã 深海ã®å ã¨ãããã¼ã¹ãç¬ç¹ã®é°å²æ°ã§ç´ æ´ãããã£ãã®ã¨ããã¤ãªã¦ã°ã½ã¯ã ã·ããã«ãä¼ããããã¨ãã§ããã®ã§ã大å¤æºè¶³æãããã¾ããã
以åãèªåãã¹ã¿ããåå ããã¤ãã³ãã«ãã¤ãªã¦ã°ã½ã¯ã ã·ãããæ¥ã¦ããã®ã§ãããé·èã®åãã§ãã¦ããä¼æ©æéã§ã¯è¦ããã¨ãã§ããªãã£ããã§ããã⦠å人çãªè©±ã§ããããªãã³ã¸ãæãããã¨ãã§ãã¾ããã
ãã¦ã沼津ãçºã£ã¦ãå¤æ¹ããã«å±±åæ 館ããã«å°çãã¾ããã å¤æ¹ããã¯ä¼è°å®¤ãåãã¦ã®ããªã¼ãã£ã³ã°ã§ãã ããã¾ã§ã観å æ è¡è¨ã¿ããã«ãªã£ã¦ãã¾ãããããããéçºå宿ããããåºã¦ãã¾ãããã
ã¿ã¹ã¯ãæ´ãåºãã¦ããAWS Elasticsearch Serviceå¨ãã®èª¿æ»ã¨è¨å®ããèªåãããRailsããElasticsearchã¸ã®æ¥ç¶å¨ãããtaiki-tããããã¨ããå½¢ã§ãã£ããåæ ãã¾ãã ãã®æç¹ã§Elasticsearchã®ç¥èããã¾ããªãã£ããããã¨ããããåºæ¬çãªä»çµã¿ã調ã¹ã¦ããã ãã§å¤é£ã®æéã«ãªã£ã¦ãã¾ãã¾ããã
åçã®ãã®ã®ä»ã«ãã飯ã»æ±ç©ã»è¶ç¢è¸ãã»å¤©ã·ããªã©ãå¾ããåºã¦ãã¾ããã å±±åæ 館ããã®ã飯ã¯é常ã«ç¾å³ãããããªã¥ã¼ã ããã£ã¦ç´ æ´ãããã£ãã§ãã
é£å¾ã«æ¸©æ³ã«å ¥ã£ã¦ããä¸èª¿ã¹ã®ç¶ãããã¦ããã®ã§ãããç¡éã«æããæ©ã ã«ç ã£ã¦ãã¾ãã¾ãã⦠ææ¥ãææ¥ã¯é å¼µãâ¦
2æ¥ç®
ãã®æ¥ã¯ååä¸ã«ä¼æ±æ¹¯ã®è±éãååºè¡ãæ£çãã¾ããã èèã®æ¤¿æ²¹å°éåºãªã©èå³ãæ¹ããããåºãå¤ãä¸ãã湯ããä¸ç¦ç¥ã®ã¹ã¿ã³ãã©ãªã¼ãtaiki-tãããåã ã¨ãã¦ã³ã³ããã¦ããã®ãå°è±¡çã§ããã
åå¾ããã¯ãè¿ãã«ããæ±æµ·é¤¨ãè¦å¦ãã¾ããã ãã«ãã¨ã»ããã¨ã«åºã¦ããæ±æ館ã®ã¢ãã«ã«ããªã£ã¦ããããããæ´å²ãæãã建ç©ã§ããã
ãã ãæ´å²ãæãã建ç©ã®ä¸ã«çªå¦ã¨ãã¦ç¾ãããç¾ä»£çç»é¢¨ã®æºé ¼æãã御ä¸å®¶ããããã¤ã³ãã¯ãã§ããã 確ãé³ç¡ç¥ç¤¾ã«é¢ããå±ç¤ºã ã£ãã¨æãã¾ãã å «é姫ããããã¨å¯æãããã§ãã
ãã¦ãæ±æµ·é¤¨è¦å¦ã®å¾ã¯ãä½µè¨ã®å«è¶å®¤ã§ã³ã¼ãã¼ã飲ã¿ã¤ã¤ä½æ¥ã®ç¶ãããã¦ãã¾ããã ãã®æç¹ã§REST APIçµç±ã§ã®å®é¨ãéãã¦ãMappingã®è¨å®ãããç¨åº¦åºãããã¨ãã§ãã¾ããã æ´å²ãã建ç©ã§å·ã®ãããããèãã¤ã¤ä½æ¥ããã®ã¯é常ã«æ°æã¡ããã£ãã®ã§ãæ±æµ·é¤¨ã«è¡ããããã¨ãããã°ãã²ã試ããã ããã
å¤ã«ã¯taiki-tããã®ä½ã£ãRailså´ã¨ã®ã¤ãªãè¾¼ã¿ãè¡ããåç®æ¤ç´¢ãElasticsearchä¸ã§åãããã«ãªãã¾ããã ãã ããã®æç¹ã§ã¯Mappingè¨å®ãbigramã®ã¿ã ã£ããã1æåã§æ¤ç´¢ãã§ããªãã£ãããå ¥åã¨å é ä¸è´ãããã®ãæåã«åºã¦ããªããªã©ãããã¤ãä¸æºãªç¹ãããã¾ããã
23æãè¶ ãã辺ãã§ã»ãã®äººãå¯éã¾ãé¨å±ã§ã®ä½æ¥ããã¥ããæãã«ãªã£ãã®ã§ãããä¸è¨ã®ä¸æºç¹ãæ°ã«ãªã£ããããä¸äººã§ããã¼ã«è¡ãMappingã®è¨å®èª¿æ´ãè¡ãã¾ããã è¬ã®è½é¢ãå±ç¤ºããã¦ãããããè½é¢ã«è¦å®ãã(ãããã¯ç¨ã¾ã)ãªããããã°ã©ãã³ã°ãããã¨ããã大å¤ã·ã¥ã¼ã«ãªçµµé¢ã ã£ãã¨æãã¾ãã æ¤ç´¢ã1æåã®å ´åã®ã¿matchæ¤ç´¢ããtermæ¤ç´¢ã«åæ¿ãããæ¤ç´¢ã¯ã¨ãªãbigramã¨å é ä¸è´ã¨ã®boolã«ããããªã©ã®å¯¾å¿ã2æé ã«å®äºããç¡äºä¸è¨ã®èª²é¡ã解決ãããããé¨å±ã«å¸°ã£ã¦å¯ã¾ããã
3æ¥ç®
æçµæ¥ã¯ææå ±åä¼ããã¦ãå±±åæ 館ãããå¾ã«ãã¾ããã ã¨ããããåããã®ãè¦ãããã¦ä¸å®å¿ã§ãã å±±åæ 館ããããããã¨ããããã¾ããï¼
ãã®å¾
ãã¦ãElasticsearchã使ã£ãæ¤ç´¢ã¯ã調æ´ãçµã¦å æ¥ãªãªã¼ã¹ããã¾ããã ãã®éã«ãæ¼¢åãèªã¿ããªã§ãæ¤ç´¢ã§ãããªã©ãæ©è½ãä¸é¨å¼·åããã¦ãã¾ãã
å é ä¸è´ãåªå ãã¦è¡¨ç¤ºãããã
ããè¦ãã§ãæ¤ç´¢ã§ãããã
æ¼¢åã§å ¥åãããã®ãã²ãããªã§æ¤ç´¢ã§ãããã
ã¨ãé¨åä¸è´ã®ã¿ã ã£ã以åããã ãã¶è³¢ããªã£ã¦ãã¾ãã å¿çé度ãã以åã«æ¯ã¹ã¦ããããã¨è¡¨ç¤ºãããããã«ãªãã¾ããã
ã¾ã¨ã
å ¥ç¤¾2é±éã¡ããã§ãããªãé£ãã¦è¡ãããéçºå宿ã§ãããã楽ããéçºãããã¨ãã§ãã¾ããã éçºå宿ã¨ãããã®èªä½ãåãã¦ã ã£ãã®ã§ãããã¤ãã¤ãå¨è¾ºã®è¦³å ãããã温æ³ã§ã®ãã³ããããã§æéã使ã£ãã®ã§ãéçºå宿ã§ã¯éã®æå¿ã§ä½æ¥ãé²ããããä½è£ãæã£ã¦2ã3æ³ãããã®ã¹ã±ã¸ã¥ã¼ã«ã«ããã®ãè¯ãããã§ããã
ããã§ã¯çãããã¡ãªã¼ã¯ãªã¹ãã¹ & è¯ããå¹´ãã