.. -*- rst -*- .. highlightlang:: none .. groonga-include : search.txt .. groonga-command .. database: tutorial ããªã«ãã¦ã³ ============ groongaã§ã¯ãç¹å®ã®ã«ã©ã å¤ã§æ¤ç´¢çµæãã°ã«ã¼ãåãããã¨ãã§ãã¾ãããããããªã«ãã¦ã³ã¨å¼ã³ã¾ãã Siteãã¼ãã«ã«ï¼ã¤ã®ã«ã©ã ã追å ãã¾ããTLDãã¡ã¤ã³åãæ ¼ç´ããdomainã«ã©ã ã¨ãå½åãæ ¼ç´ããcountryã«ã©ã ã§ãããããã®ã«ã©ã ã®åã¯ããããããã¡ã¤ã³åã主ãã¼ã¨ããSiteDomainãã¼ãã«ã¨ãå½åã主ãã¼ã¨ããSiteCountryãã¼ãã«ã¨ãã¾ãã .. groonga-command .. include:: ../example/tutorial/drilldown-1.log .. table_create --name SiteDomain --flags TABLE_HASH_KEY --key_type ShortText .. table_create --name SiteCountry --flags TABLE_HASH_KEY --key_type ShortText .. column_create --table Site --name domain --flags COLUMN_SCALAR --type SiteDomain .. column_create --table Site --name country --flags COLUMN_SCALAR --type SiteCountry .. load --table Site .. [ .. {"_key":"http://example.org/","domain":".org","country":"japan"}, .. {"_key":"http://example.net/","domain":".net","country":"brazil"}, .. {"_key":"http://example.com/","domain":".com","country":"japan"}, .. {"_key":"http://example.net/afr","domain":".net","country":"usa"}, .. {"_key":"http://example.org/aba","domain":".org","country":"korea"}, .. {"_key":"http://example.com/rab","domain":".com","country":"china"}, .. {"_key":"http://example.net/atv","domain":".net","country":"china"}, .. {"_key":"http://example.org/gat","domain":".org","country":"usa"}, .. {"_key":"http://example.com/vdw","domain":".com","country":"japan"} .. ] domainã«ã©ã ã¨countryã«ã©ã ã§ããªã«ãã¦ã³ãè¡ãä¾ã以ä¸ã«ç¤ºãã¾ãã .. groonga-command .. include:: ../example/tutorial/drilldown-2.log .. select --table Site --limit 0 --drilldown domain ãã¼ãã«åãæã¤ã«ã©ã ã«å¯¾ãã¦ããªã«ãã¦ã³ãè¡ã£ãå ´åãåç §å ã®ãã¼ãã«ã«åå¨ããã«ã©ã å¤ãåå¾ãããã¨ãã§ãã¾ããããªã«ãã¦ã³ãè¡ã£ããã¼ãã«ã«ã¯ã_nsubrecsã¨ããä»®æ³çãªã«ã©ã ã追å ããã¾ãããã®ã«ã©ã ã«ã¯ãã°ã«ã¼ãåãããã¬ã³ã¼ãæ°ãå ¥ãã¾ãã .. groonga-command .. include:: ../example/tutorial/drilldown-3.log .. select --table Site --limit 0 --drilldown domain --drilldown_output_columns _id,_key,_nsubrecs è¤æ°ã®ã«ã©ã ã«å¯¾ãã¦ããªã«ãã¦ã³ãè¡ããã¨ãã§ãã¾ããè¤æ°ã®ã«ã©ã ã«å¯¾ãã¦ããªã«ãã¦ã³ãè¡ãå ´åã«ã¯ãdrilldownãã©ã¡ã¼ã¿ã«ã«ã©ã åãã«ã³ãåºåãã§ä¸ãã¾ãã .. groonga-command .. include:: ../example/tutorial/drilldown-4.log .. select --table Site --limit 0 --drilldown domain,country ããªã«ãã¦ã³çµæã並ã³ããããã¨ãã§ãã¾ããä¾ãã°ã_nsubrecsãã©ã¡ã¼ã¿ã®éé ã§ä¸¦ã³æ¿ãããã¨ãã§ãã¾ãã .. groonga-command .. include:: ../example/tutorial/drilldown-5.log .. select --table Site --limit 0 --drilldown country --drilldown_sortby _nsubrecs ããªã«ãã¦ã³çµæã¯ãããã©ã«ãã§ã¯10件ã®ã¿è¡¨ç¤ºããã¾ããdrilldown_offsetãã©ã¡ã¼ã¿ã¨ãdrilldown_limitãã©ã¡ã¼ã¿ã«ãã£ã¦ãoffsetã¨limitãæå®ãããã¨ãã§ãã¾ãã .. groonga-command .. include:: ../example/tutorial/drilldown-6.log .. select --table Site --limit 0 --drilldown country --drilldown_sortby _nsubrecs --drilldown_limit 2 --drilldown_offset 2 æåååã®ã«ã©ã ã«å¯¾ããããªã«ãã¦ã³ã¯ãä»ã®åã§ã®ããªã«ãã¦ã³ã«æ¯ã¹ã¦ä½éã§ããæååã§ã®ããªã«ãã¦ã³ãè¡ãããå ´åã«ã¯ããã®ãã¥ã¼ããªã¢ã«ã®ããã«ãæåååã主ãã¼ã¨ãããã¼ãã«ãå¥éä½æãããã®ãã¼ãã«ãåã¨ããã«ã©ã ãä½æãã¾ãã