rroonga 0.9.5-x86-mingw32 → 1.0.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/NEWS.ja.rdoc +24 -0
- data/NEWS.rdoc +24 -0
- data/README.ja.rdoc +3 -2
- data/README.rdoc +3 -2
- data/Rakefile +15 -6
- data/ext/groonga/extconf.rb +25 -25
- data/ext/groonga/groonga.def +2 -0
- data/ext/groonga/rb-grn-array.c +1 -1
- data/ext/groonga/rb-grn-exception.c +14 -0
- data/ext/groonga/rb-grn-hash.c +1 -1
- data/ext/groonga/rb-grn-index-column.c +13 -1
- data/ext/groonga/rb-grn-object.c +2 -2
- data/ext/groonga/rb-grn-patricia-trie.c +394 -1
- data/ext/groonga/rb-grn-table.c +33 -2
- data/ext/groonga/rb-grn.h +3 -3
- data/html/index.html +1 -1
- data/lib/1.8/groonga.so +0 -0
- data/lib/1.9/groonga.so +0 -0
- data/lib/groonga/record.rb +32 -2
- data/lib/groonga/schema.rb +1 -1
- data/rroonga-build.rb +3 -3
- data/test/test-patricia-trie.rb +172 -1
- data/test/test-record.rb +7 -0
- data/test/test-remote.rb +2 -1
- data/test/test-table-cursor.rb +35 -1
- data/test/test-table-select-normalize.rb +7 -3
- data/vendor/local/bin/grntest.exe +0 -0
- data/vendor/local/bin/groonga.exe +0 -0
- data/vendor/local/bin/libgroonga-0.dll +0 -0
- data/vendor/local/etc/groonga/groonga.conf +11 -0
- data/vendor/local/etc/groonga/init.d/redhat/groonga +168 -0
- data/vendor/local/etc/groonga/init.d/redhat/sysconfig/groonga +8 -0
- data/vendor/local/include/groonga/groonga.h +38 -12
- data/vendor/local/lib/groonga/modules/suggest/suggest.a +0 -0
- data/vendor/local/lib/groonga/modules/suggest/suggest.dll +0 -0
- data/vendor/local/lib/groonga/modules/suggest/suggest.dll.a +0 -0
- data/vendor/local/lib/groonga/modules/{functions/cast.la → suggest/suggest.la} +6 -6
- data/vendor/local/lib/libgroonga.a +0 -0
- data/vendor/local/lib/libgroonga.dll.a +0 -0
- data/vendor/local/lib/pkgconfig/groonga.pc +1 -1
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/vendor/local/share/groonga/admin_html/images/groonga.png +0 -0
- data/vendor/local/share/groonga/admin_html/images/loading.gif +0 -0
- data/vendor/local/share/groonga/admin_html/js/jquery.json-2.2.min.js +31 -0
- data/vendor/local/share/groonga/doc/ja/html/.buildinfo +4 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/characteristic.txt +56 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands.txt +10 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/cache_limit.txt +52 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/check.txt +164 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/clearlock.txt +61 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/column_create.txt +93 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/column_list.txt +97 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/column_remove.txt +58 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/define_selector.txt +114 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/defrag.txt +57 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/delete.txt +68 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/dump.txt +62 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/load.txt +98 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/log_level.txt +65 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/log_put.txt +69 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/log_reopen.txt +66 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/quit.txt +38 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/select.txt +247 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/shutdown.txt +38 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/status.txt +59 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/suggest.txt +79 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/table_create.txt +111 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/table_list.txt +87 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/table_remove.txt +50 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands/view_add.txt +53 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands_not_implemented/add.txt +102 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands_not_implemented/get.txt +78 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/commands_not_implemented/set.txt +103 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/developer.txt +10 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/developer/com.txt +18 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/developer/document.txt +38 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/developer/query.txt +212 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/developer/test.txt +114 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/execfile.txt +226 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/expr.txt +43 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/functions.txt +10 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/functions/edit_distance.txt +48 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/functions/geo_distance.txt +51 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/functions/geo_in_circle.txt +54 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/functions/geo_in_rectangle.txt +55 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/functions/now.txt +34 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/functions/rand.txt +41 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/grnslap.txt +64 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/grntest.txt +259 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/http.txt +52 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/index.txt +21 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/install.txt +114 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/news.txt +199 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/process.txt +12 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/pseudo_column.txt +38 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/reference.txt +14 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial.txt +10 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial01.txt +293 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial02.txt +100 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial03.txt +72 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial04.txt +111 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial05.txt +65 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial06.txt +91 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial07.txt +92 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial08.txt +53 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial09.txt +9 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial10.txt +486 -0
- data/vendor/local/share/groonga/doc/ja/html/_sources/type.txt +118 -0
- data/vendor/local/share/groonga/doc/ja/html/_static/basic.css +509 -0
- data/vendor/local/share/groonga/doc/ja/html/_static/default.css +277 -0
- data/vendor/local/share/groonga/doc/ja/html/_static/doctools.js +247 -0
- data/vendor/local/share/groonga/doc/ja/html/_static/file.png +0 -0
- data/vendor/local/share/groonga/doc/ja/html/_static/jquery.js +6240 -0
- data/vendor/local/share/groonga/doc/ja/html/_static/minus.png +0 -0
- data/vendor/local/share/groonga/doc/ja/html/_static/plus.png +0 -0
- data/vendor/local/share/groonga/doc/ja/html/_static/pygments.css +61 -0
- data/vendor/local/share/groonga/doc/ja/html/_static/searchtools.js +518 -0
- data/vendor/local/share/groonga/doc/ja/html/_static/sidebar.js +147 -0
- data/vendor/local/share/groonga/doc/ja/html/_static/underscore.js +16 -0
- data/vendor/local/share/groonga/doc/ja/html/characteristic.html +162 -0
- data/vendor/local/share/groonga/doc/ja/html/commands.html +139 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/cache_limit.html +173 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/check.html +285 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/clearlock.html +180 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/column_create.html +210 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/column_list.html +220 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/column_remove.html +183 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/define_selector.html +221 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/defrag.html +177 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/delete.html +182 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/dump.html +177 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/load.html +208 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/log_level.html +187 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/log_put.html +190 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/log_reopen.html +188 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/quit.html +156 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/select.html +331 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/shutdown.html +156 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/status.html +179 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/suggest.html +191 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/table_create.html +222 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/table_list.html +202 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/table_remove.html +173 -0
- data/vendor/local/share/groonga/doc/ja/html/commands/view_add.html +175 -0
- data/vendor/local/share/groonga/doc/ja/html/commands_not_implemented/add.html +180 -0
- data/vendor/local/share/groonga/doc/ja/html/commands_not_implemented/get.html +161 -0
- data/vendor/local/share/groonga/doc/ja/html/commands_not_implemented/set.html +182 -0
- data/vendor/local/share/groonga/doc/ja/html/developer.html +118 -0
- data/vendor/local/share/groonga/doc/ja/html/developer/com.html +136 -0
- data/vendor/local/share/groonga/doc/ja/html/developer/document.html +159 -0
- data/vendor/local/share/groonga/doc/ja/html/developer/query.html +336 -0
- data/vendor/local/share/groonga/doc/ja/html/developer/test.html +220 -0
- data/vendor/local/share/groonga/doc/ja/html/execfile.html +370 -0
- data/vendor/local/share/groonga/doc/ja/html/expr.html +157 -0
- data/vendor/local/share/groonga/doc/ja/html/functions.html +122 -0
- data/vendor/local/share/groonga/doc/ja/html/functions/edit_distance.html +162 -0
- data/vendor/local/share/groonga/doc/ja/html/functions/geo_distance.html +170 -0
- data/vendor/local/share/groonga/doc/ja/html/functions/geo_in_circle.html +173 -0
- data/vendor/local/share/groonga/doc/ja/html/functions/geo_in_rectangle.html +172 -0
- data/vendor/local/share/groonga/doc/ja/html/functions/now.html +152 -0
- data/vendor/local/share/groonga/doc/ja/html/functions/rand.html +159 -0
- data/vendor/local/share/groonga/doc/ja/html/genindex.html +227 -0
- data/vendor/local/share/groonga/doc/ja/html/grnslap.html +183 -0
- data/vendor/local/share/groonga/doc/ja/html/grntest.html +368 -0
- data/vendor/local/share/groonga/doc/ja/html/http.html +163 -0
- data/vendor/local/share/groonga/doc/ja/html/index.html +291 -0
- data/vendor/local/share/groonga/doc/ja/html/install.html +228 -0
- data/vendor/local/share/groonga/doc/ja/html/news.html +310 -0
- data/vendor/local/share/groonga/doc/ja/html/objects.inv +0 -0
- data/vendor/local/share/groonga/doc/ja/html/process.html +120 -0
- data/vendor/local/share/groonga/doc/ja/html/pseudo_column.html +147 -0
- data/vendor/local/share/groonga/doc/ja/html/reference.html +174 -0
- data/vendor/local/share/groonga/doc/ja/html/search.html +96 -0
- data/vendor/local/share/groonga/doc/ja/html/searchindex.js +1 -0
- data/vendor/local/share/groonga/doc/ja/html/tutorial.html +172 -0
- data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial01.html +388 -0
- data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial02.html +214 -0
- data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial03.html +183 -0
- data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial04.html +212 -0
- data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial05.html +169 -0
- data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial06.html +209 -0
- data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial07.html +212 -0
- data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial08.html +139 -0
- data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial09.html +114 -0
- data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial10.html +458 -0
- data/vendor/local/share/groonga/doc/ja/html/type.html +217 -0
- data/vendor/local/share/groonga/doc/ja/source/__init__.py +0 -0
- data/vendor/local/share/groonga/doc/ja/source/characteristic.txt +56 -0
- data/vendor/local/share/groonga/doc/ja/source/commands.txt +10 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/cache_limit.txt +52 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/check.txt +164 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/clearlock.txt +61 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/column_create.txt +93 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/column_list.txt +97 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/column_remove.txt +58 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/define_selector.txt +114 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/defrag.txt +57 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/delete.txt +68 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/dump.txt +62 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/load.txt +98 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/log_level.txt +65 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/log_put.txt +69 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/log_reopen.txt +66 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/quit.txt +38 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/select.txt +247 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/shutdown.txt +38 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/status.txt +59 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/table_create.txt +111 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/table_list.txt +87 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/table_remove.txt +50 -0
- data/vendor/local/share/groonga/doc/ja/source/commands/view_add.txt +53 -0
- data/vendor/local/share/groonga/doc/ja/source/commands_not_implemented/add.txt +102 -0
- data/vendor/local/share/groonga/doc/ja/source/commands_not_implemented/get.txt +78 -0
- data/vendor/local/share/groonga/doc/ja/source/commands_not_implemented/set.txt +103 -0
- data/vendor/local/share/groonga/doc/ja/source/conf.py +265 -0
- data/vendor/local/share/groonga/doc/ja/source/developer.txt +10 -0
- data/vendor/local/share/groonga/doc/ja/source/developer/com.txt +18 -0
- data/vendor/local/share/groonga/doc/ja/source/developer/document.txt +38 -0
- data/vendor/local/share/groonga/doc/ja/source/developer/query.txt +212 -0
- data/vendor/local/share/groonga/doc/ja/source/developer/test.txt +114 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-1.log +6 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-10.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-11.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-12.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-13.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-14.log +9 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-15.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-16.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-17.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-2.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-3.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-4.log +7 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-5.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-6.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-7.log +16 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-8.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-9.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial02-1.log +8 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial02-2.log +6 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial02-3.log +12 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial03-1.log +18 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial03-2.log +10 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial03-3.log +10 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-1.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-2.log +7 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-3.log +7 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-4.log +13 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-5.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-6.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-7.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-1.log +24 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-2.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-3.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-4.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-5.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-6.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial06-1.log +25 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial06-2.log +9 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial06-3.log +21 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial06-4.log +7 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial06-5.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial07-1.log +22 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial07-2.log +9 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial07-3.log +20 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial07-4.log +9 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial08-1.log +14 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-1.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-10.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-2.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-3.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-4.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-5.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-6.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-7.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-8.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-9.log +5 -0
- data/vendor/local/share/groonga/doc/ja/source/execfile.txt +226 -0
- data/vendor/local/share/groonga/doc/ja/source/expr.txt +43 -0
- data/vendor/local/share/groonga/doc/ja/source/functions.txt +10 -0
- data/vendor/local/share/groonga/doc/ja/source/functions/edit_distance.txt +48 -0
- data/vendor/local/share/groonga/doc/ja/source/functions/geo_distance.txt +51 -0
- data/vendor/local/share/groonga/doc/ja/source/functions/geo_in_circle.txt +54 -0
- data/vendor/local/share/groonga/doc/ja/source/functions/geo_in_rectangle.txt +55 -0
- data/vendor/local/share/groonga/doc/ja/source/functions/now.txt +34 -0
- data/vendor/local/share/groonga/doc/ja/source/functions/rand.txt +41 -0
- data/vendor/local/share/groonga/doc/ja/source/grnslap.txt +64 -0
- data/vendor/local/share/groonga/doc/ja/source/grntest.txt +259 -0
- data/vendor/local/share/groonga/doc/ja/source/http.txt +52 -0
- data/vendor/local/share/groonga/doc/ja/source/index.txt +21 -0
- data/vendor/local/share/groonga/doc/ja/source/install.txt +114 -0
- data/vendor/local/share/groonga/doc/ja/source/news.txt +199 -0
- data/vendor/local/share/groonga/doc/ja/source/process.txt +12 -0
- data/vendor/local/share/groonga/doc/ja/source/pseudo_column.txt +38 -0
- data/vendor/local/share/groonga/doc/ja/source/rdoc.py +762 -0
- data/vendor/local/share/groonga/doc/ja/source/reference.txt +14 -0
- data/vendor/local/share/groonga/doc/ja/source/tutorial.txt +10 -0
- data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial01.txt +293 -0
- data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial02.txt +100 -0
- data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial03.txt +72 -0
- data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial04.txt +111 -0
- data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial05.txt +65 -0
- data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial06.txt +91 -0
- data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial07.txt +92 -0
- data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial08.txt +53 -0
- data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial09.txt +9 -0
- data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial10.txt +486 -0
- data/vendor/local/share/groonga/doc/ja/source/type.txt +118 -0
- data/vendor/local/share/groonga/doc/ja/source/update_execution_example.py +113 -0
- data/vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb +46 -0
- data/vendor/local/share/groonga/examples/dictionary/edict/edict_import.sh +10 -0
- data/vendor/local/share/groonga/examples/dictionary/eijiro/eijiro2grn.rb +61 -0
- data/vendor/local/share/groonga/examples/dictionary/eijiro/eijiro_import.sh +10 -0
- data/vendor/local/share/groonga/examples/dictionary/gene95/gene2grn.rb +46 -0
- data/vendor/local/share/groonga/examples/dictionary/gene95/gene_import.sh +10 -0
- data/vendor/local/share/groonga/examples/dictionary/html/css/dictionary.css +3 -0
- data/vendor/local/share/groonga/examples/dictionary/html/index.html +26 -0
- data/vendor/local/share/groonga/examples/dictionary/html/js/dictionary.js +51 -0
- data/vendor/local/share/groonga/examples/dictionary/html/js/jquery-1.4.2.min.js +154 -0
- data/vendor/local/share/groonga/examples/dictionary/init_db.sh +10 -0
- data/vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb +42 -0
- data/vendor/local/share/groonga/examples/dictionary/readme.txt +71 -0
- data/vendor/local/share/man/man1/groonga.1 +5498 -0
- metadata +360 -118
- data/pkg-config.rb +0 -333
- data/pkg/rroonga-0.9.5/NEWS.ja.rdoc +0 -156
- data/pkg/rroonga-0.9.5/NEWS.rdoc +0 -158
- data/pkg/rroonga-0.9.5/README.ja.rdoc +0 -65
- data/pkg/rroonga-0.9.5/README.rdoc +0 -66
- data/pkg/rroonga-0.9.5/text/TUTORIAL.ja.rdoc +0 -394
- data/pkg/rroonga-0.9.5/text/expression.rdoc +0 -285
- data/test-unit/Rakefile +0 -40
- data/test-unit/TODO +0 -5
- data/test-unit/bin/testrb +0 -5
- data/test-unit/html/classic.html +0 -15
- data/test-unit/html/index.html +0 -25
- data/test-unit/html/index.html.ja +0 -27
- data/test-unit/lib/test/unit.rb +0 -323
- data/test-unit/lib/test/unit/assertionfailederror.rb +0 -25
- data/test-unit/lib/test/unit/assertions.rb +0 -1230
- data/test-unit/lib/test/unit/attribute.rb +0 -125
- data/test-unit/lib/test/unit/autorunner.rb +0 -360
- data/test-unit/lib/test/unit/collector.rb +0 -36
- data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
- data/test-unit/lib/test/unit/collector/dir.rb +0 -108
- data/test-unit/lib/test/unit/collector/load.rb +0 -144
- data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
- data/test-unit/lib/test/unit/color-scheme.rb +0 -102
- data/test-unit/lib/test/unit/color.rb +0 -96
- data/test-unit/lib/test/unit/diff.rb +0 -724
- data/test-unit/lib/test/unit/error.rb +0 -130
- data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
- data/test-unit/lib/test/unit/failure.rb +0 -136
- data/test-unit/lib/test/unit/fixture.rb +0 -176
- data/test-unit/lib/test/unit/notification.rb +0 -129
- data/test-unit/lib/test/unit/omission.rb +0 -191
- data/test-unit/lib/test/unit/pending.rb +0 -150
- data/test-unit/lib/test/unit/priority.rb +0 -180
- data/test-unit/lib/test/unit/runner/console.rb +0 -52
- data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
- data/test-unit/lib/test/unit/runner/tap.rb +0 -8
- data/test-unit/lib/test/unit/testcase.rb +0 -476
- data/test-unit/lib/test/unit/testresult.rb +0 -89
- data/test-unit/lib/test/unit/testsuite.rb +0 -110
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -466
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -63
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -92
- data/test-unit/lib/test/unit/ui/testrunner.rb +0 -28
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
- data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
- data/test-unit/lib/test/unit/util/observable.rb +0 -90
- data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
- data/test-unit/lib/test/unit/version.rb +0 -7
- data/test-unit/sample/adder.rb +0 -13
- data/test-unit/sample/subtracter.rb +0 -12
- data/test-unit/sample/test_adder.rb +0 -20
- data/test-unit/sample/test_subtracter.rb +0 -20
- data/test-unit/sample/test_user.rb +0 -23
- data/test-unit/test/collector/test-descendant.rb +0 -133
- data/test-unit/test/collector/test-load.rb +0 -442
- data/test-unit/test/collector/test_dir.rb +0 -406
- data/test-unit/test/collector/test_objectspace.rb +0 -100
- data/test-unit/test/run-test.rb +0 -15
- data/test-unit/test/test-attribute.rb +0 -86
- data/test-unit/test/test-color-scheme.rb +0 -67
- data/test-unit/test/test-color.rb +0 -47
- data/test-unit/test/test-diff.rb +0 -518
- data/test-unit/test/test-emacs-runner.rb +0 -60
- data/test-unit/test/test-fixture.rb +0 -287
- data/test-unit/test/test-notification.rb +0 -33
- data/test-unit/test/test-omission.rb +0 -81
- data/test-unit/test/test-pending.rb +0 -70
- data/test-unit/test/test-priority.rb +0 -119
- data/test-unit/test/test-testcase.rb +0 -544
- data/test-unit/test/test_assertions.rb +0 -1151
- data/test-unit/test/test_error.rb +0 -26
- data/test-unit/test/test_failure.rb +0 -33
- data/test-unit/test/test_testresult.rb +0 -113
- data/test-unit/test/test_testsuite.rb +0 -129
- data/test-unit/test/testunit-test-util.rb +0 -14
- data/test-unit/test/ui/test_testrunmediator.rb +0 -20
- data/test-unit/test/util/test-method-owner-finder.rb +0 -38
- data/test-unit/test/util/test_backtracefilter.rb +0 -41
- data/test-unit/test/util/test_observable.rb +0 -102
- data/test-unit/test/util/test_procwrapper.rb +0 -36
- data/vendor/local/lib/groonga/modules/functions/cast.dll +0 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
.. highlightlang:: none
|
2
|
+
|
3
|
+
.. groonga-include : tutorial03.txt
|
4
|
+
|
5
|
+
さまざまな検索条件の指定
|
6
|
+
========================
|
7
|
+
|
8
|
+
groongaは、JavaScriptに似た文法での条件絞込や、計算した値を用いたソートを行うことができます。また、位置情報(緯度・経度)を用いた絞込・ソートを行うことができます。
|
9
|
+
|
10
|
+
JavaScriptに似た文法での絞込・全文検索
|
11
|
+
--------------------------------------
|
12
|
+
|
13
|
+
selectコマンドのfilterパラメータは、queryパラメータと同様に、レコードの検索条件を指定します。filterパラメータとqueryパラメータが異なる点は、filterパラメータには、JavaScriptの式に似た文法で条件を指定する点です。
|
14
|
+
|
15
|
+
.. groonga-command
|
16
|
+
.. include:: ../example/tutorial04-1.log
|
17
|
+
.. select --table Site --filter "_id <= 1" --output_columns _id,_key
|
18
|
+
|
19
|
+
ここで、filterパラメータには
|
20
|
+
|
21
|
+
_id <= 1
|
22
|
+
|
23
|
+
という条件を指定しています。この場合は_idの値が1以下のレコードが検索結果として得られます。
|
24
|
+
|
25
|
+
また、&& や || を使って、条件のAND・OR指定をすることもできます。
|
26
|
+
|
27
|
+
.. groonga-command
|
28
|
+
.. include:: ../example/tutorial04-2.log
|
29
|
+
.. select --table Site --filter "_id >= 4 && _id <= 6" --output_columns _id,_key
|
30
|
+
.. select --table Site --filter "_id <= 2 || _id >= 7" --output_columns _id,_key
|
31
|
+
|
32
|
+
queryパラメータとfilterパラメータを同時に指定すると、両者の条件をともに満たすレコードが結果として返ります。
|
33
|
+
|
34
|
+
scorerを利用したソート
|
35
|
+
----------------------
|
36
|
+
|
37
|
+
selectコマンドのscorerパラメータは、
|
38
|
+
全文検索を行った結果の各レコードに対して処理を行うためのパラメータです。
|
39
|
+
|
40
|
+
filterパラメータと同様に、
|
41
|
+
JavaScriptの式に似たな文法で様々な条件を指定することができます。
|
42
|
+
|
43
|
+
.. groonga-command
|
44
|
+
.. include:: ../example/tutorial04-3.log
|
45
|
+
.. select --table Site --filter "1" --scorer "_score = rand()" --output_columns _id,_key,_score --sortby _score
|
46
|
+
.. select --table Site --filter "1" --scorer "_score = rand()" --output_columns _id,_key,_score --sortby _score
|
47
|
+
|
48
|
+
検索結果には、'_score'という名前の、全文検索のスコアが代入されている仮想的なカラムが付与されることをチュートリアル中ソートの項目で説明しました。
|
49
|
+
|
50
|
+
上記の実行例では、scorerパラメータに
|
51
|
+
|
52
|
+
_score = rand()
|
53
|
+
|
54
|
+
という条件を指定しています。ここでは、rand()という乱数を返す関数を用いて、全文検索のスコアを乱数で上書きしています。
|
55
|
+
|
56
|
+
sortbyパラメータには、
|
57
|
+
|
58
|
+
_score
|
59
|
+
|
60
|
+
を指定しています。これは、スコア順に昇順にソートすることを意味しています。
|
61
|
+
|
62
|
+
よって、上記のクエリは実行されるたびに検索結果の並び順がランダムに変わります。
|
63
|
+
|
64
|
+
位置情報を用いた絞込・ソート
|
65
|
+
----------------------------
|
66
|
+
|
67
|
+
groongaでは、位置情報(経緯度)を保存することができます。また、保存した経緯度を用いて絞込やソートができます。
|
68
|
+
|
69
|
+
位置情報を保存するためのカラムの型として、TokyoGeoPoint/WGS84GeoPointの2つの型があります。前者は日本測地系、後者は世界測地系(WGS84相当)の経緯度を保存します。
|
70
|
+
|
71
|
+
経緯度をデータを入力するためには、"緯度のミリ秒x経度のミリ秒"という形式の文字列を代入する必要があります。
|
72
|
+
|
73
|
+
ここでは、ためしに東京駅と新宿駅とついて、世界測地系での位置情報を保存してみましょう。東京駅は緯度が35度40分52.975秒、経度が139度45分57.902秒です。新宿駅は緯度が35度41分27.316秒、経度が139度42分0.929秒です。よって、代入する文字列はそれぞれ"128452975x503157902"/"128487316x502920929"となります。
|
74
|
+
|
75
|
+
.. groonga-command
|
76
|
+
.. include:: ../example/tutorial04-4.log
|
77
|
+
.. column_create --table Site --name location --type WGS84GeoPoint
|
78
|
+
.. load --table Site
|
79
|
+
.. [
|
80
|
+
.. {"_key":"http://example.org/","location":"128452975x503157902"}
|
81
|
+
.. {"_key":"http://example.net/","location":"128487316x502920929"},
|
82
|
+
.. ]
|
83
|
+
.. select --table Site --query "_id:1 OR _id:2" --output_columns _key,location
|
84
|
+
|
85
|
+
scorerパラメータにおいて、 :doc:`../functions/geo_distance` 関数を用いることにより、2点間の距離を計算することができます。
|
86
|
+
|
87
|
+
ここでは、秋葉原駅からの距離を表示させてみましょう。世界測地系では、秋葉原駅の位置は緯度が35度41分55.259秒、経度が139度46分27.188秒です。よって、geo_distance関数に与える文字列は"128515259x503187188"となります。
|
88
|
+
|
89
|
+
.. groonga-command
|
90
|
+
.. include:: ../example/tutorial04-5.log
|
91
|
+
.. select --table Site --query "_id:1 OR _id:2" --output_columns _key,location,_score --scorer '_score = geo_distance(location, "128515259x503187188")'
|
92
|
+
|
93
|
+
この結果を見ると、東京駅と秋葉原駅は2054m、秋葉原駅と新宿駅は6720m離れているようです。
|
94
|
+
|
95
|
+
geo_distance関数は、_scoreを通じてソートでも用いることができます。
|
96
|
+
|
97
|
+
.. groonga-command
|
98
|
+
.. include:: ../example/tutorial04-6.log
|
99
|
+
.. select --table Site --query "_id:1 OR _id:2" --output_columns _key,location,_score --scorer '_score = geo_distance(location, "128515259x503187188")' --sortby -_score
|
100
|
+
|
101
|
+
「ある地点から何m以内に存在する」といった絞込も可能です。
|
102
|
+
|
103
|
+
filterパラメータにおいて、 :doc:`../functions/geo_in_circle` 関数を用いることにより、2点間の距離が指定のm以下におさまるかどうかを判定することができます。
|
104
|
+
|
105
|
+
たとえば、秋葉原駅から5000m以内にあるレコードを検索してみましょう。
|
106
|
+
|
107
|
+
.. groonga-command
|
108
|
+
.. include:: ../example/tutorial04-7.log
|
109
|
+
.. select --table Site --output_columns _key,location --filter 'geo_in_circle(location, "128515259x503187188", 5000)'
|
110
|
+
|
111
|
+
また、経緯度が指定の矩形領域内であるかどうかを判定する :doc:`../functions/geo_in_rectangle` 関数も存在します。
|
@@ -0,0 +1,65 @@
|
|
1
|
+
.. highlightlang:: none
|
2
|
+
|
3
|
+
.. groonga-include : tutorial04.txt
|
4
|
+
.. groonga-command
|
5
|
+
.. table_remove SiteDomain
|
6
|
+
.. table_remove SiteCountry
|
7
|
+
|
8
|
+
|
9
|
+
ドリルダウン
|
10
|
+
============
|
11
|
+
|
12
|
+
groongaでは、特定のカラム値で検索結果をグループ化することができます。これをドリルダウンと呼びます。
|
13
|
+
|
14
|
+
Siteテーブルに2つのカラムを追加します。TLDドメイン名を格納するdomainカラムと、国名を格納するcountryカラムです。これらのカラムの型は、それぞれドメイン名を主キーとするSiteDomainテーブルと、国名を主キーとするSiteCounteryテーブルとします。
|
15
|
+
|
16
|
+
.. groonga-command
|
17
|
+
.. include:: ../example/tutorial05-1.log
|
18
|
+
.. table_create --name SiteDomain --flags TABLE_HASH_KEY --key_type ShortText
|
19
|
+
.. table_create --name SiteCountry --flags TABLE_HASH_KEY --key_type ShortText
|
20
|
+
.. column_create --table Site --name domain --flags COLUMN_SCALAR --type SiteDomain
|
21
|
+
.. column_create --table Site --name country --flags COLUMN_SCALAR --type SiteCountry
|
22
|
+
.. load --table Site
|
23
|
+
.. [
|
24
|
+
.. {"_key":"http://example.org/","domain":".org","country":"japan"},
|
25
|
+
.. {"_key":"http://example.net/","domain":".net","country":"brazil"},
|
26
|
+
.. {"_key":"http://example.com/","domain":".com","country":"japan"},
|
27
|
+
.. {"_key":"http://example.net/afr","domain":".net","country":"usa"},
|
28
|
+
.. {"_key":"http://example.org/aba","domain":".org","country":"korea"},
|
29
|
+
.. {"_key":"http://example.com/rab","domain":".com","country":"china"},
|
30
|
+
.. {"_key":"http://example.net/atv","domain":".net","country":"china"},
|
31
|
+
.. {"_key":"http://example.org/gat","domain":".org","country":"usa"},
|
32
|
+
.. {"_key":"http://example.com/vdw","domain":".com","country":"japan"}
|
33
|
+
.. ]
|
34
|
+
|
35
|
+
domainカラムとcountryカラムでドリルダウンを行う例を以下に示します。
|
36
|
+
|
37
|
+
.. groonga-command
|
38
|
+
.. include:: ../example/tutorial05-2.log
|
39
|
+
.. select --table Site --limit 0 --drilldown domain
|
40
|
+
|
41
|
+
テーブル型を持つカラムに対してドリルダウンを行った場合、参照先のテーブルに存在するカラム値を取得することもできます。ドリルダウンを行ったテーブルには、_nsubrecsという仮想的なカラムが追加されます。このカラムには、グループ化されたレコード数が入ります。
|
42
|
+
|
43
|
+
.. groonga-command
|
44
|
+
.. include:: ../example/tutorial05-3.log
|
45
|
+
.. select --table Site --limit 0 --drilldown domain --drilldown_output_columns _id,_key,_nsubrecs
|
46
|
+
|
47
|
+
複数のカラムに対してドリルダウンを行うことができます。複数のカラムに対してドリルダウンを行う場合には、drilldownパラメータにカラム名をカンマ区切りで与えます。
|
48
|
+
|
49
|
+
.. groonga-command
|
50
|
+
.. include:: ../example/tutorial05-4.log
|
51
|
+
.. select --table Site --limit 0 --drilldown domain,country
|
52
|
+
|
53
|
+
ドリルダウン結果を並びかえることができます。例えば、_nsubrecsパラメータの降順で並び替えることができます。
|
54
|
+
|
55
|
+
.. groonga-command
|
56
|
+
.. include:: ../example/tutorial05-5.log
|
57
|
+
.. select --table Site --limit 0 --drilldown country --drilldown_sortby _nsubrecs
|
58
|
+
|
59
|
+
ドリルダウン結果は、デフォルトでは10件のみ表示されます。drilldown_offsetパラメータと、drilldown_limitパラメータによって、offsetとlimitを指定することができます。
|
60
|
+
|
61
|
+
.. groonga-command
|
62
|
+
.. include:: ../example/tutorial05-6.log
|
63
|
+
.. select --table Site --limit 0 --drilldown country --drilldown_sortby _nsubrecs --drilldown_limit 2 --drilldown_offset 2
|
64
|
+
|
65
|
+
文字列型のカラムに対するドリルダウンは、他の型でのドリルダウンに比べて低速です。文字列でのドリルダウンを行いたい場合には、このチュートリアルのように、文字列型を主キーとするテーブルを別途作成し、そのテーブルを型とするカラムを作成します。
|
@@ -0,0 +1,91 @@
|
|
1
|
+
.. highlightlang:: none
|
2
|
+
|
3
|
+
.. groonga-include : tutorial05.txt
|
4
|
+
|
5
|
+
タグ検索・参照関係の逆引き
|
6
|
+
==========================
|
7
|
+
|
8
|
+
本チュートリアルで、groongaはカラム値として他のテーブルへの参照の配列を持つことができることを紹介いたしました。実は、テーブルへの参照の配列データを用いることによって、いわゆるタグ検索を行うことが可能となります。
|
9
|
+
|
10
|
+
タグ検索はgroongaの転置インデックスというデータ構造を用いて高速に行われます。
|
11
|
+
|
12
|
+
タグ検索
|
13
|
+
--------
|
14
|
+
|
15
|
+
動画共有サイトの検索エンジンを作ることを想定します。1つの動画には、その動画の特徴を表す、複数の語句が付与されています。「ある語句が付与されている動画の一覧を取得する」検索を行いたいとします。
|
16
|
+
|
17
|
+
実際に、動画情報のテーブルを作成し、検索をしてみましょう。
|
18
|
+
|
19
|
+
動画の情報を保存する、Videoテーブルを作成します。Videoテーブルでは、動画のタイトルをtitleカラムに、動画のタグ情報をtagsカラムにTagテーブル型で複数格納しています。
|
20
|
+
タグの情報を保存する、Tagテーブルを作成します。Tagテーブルでは、タグ文字列を主キーに格納し、Videoテーブルのtagsカラムに対するインデックスをindex_tagsカラムに格納しています。
|
21
|
+
|
22
|
+
.. groonga-command
|
23
|
+
.. include:: ../example/tutorial06-1.log
|
24
|
+
.. table_create --name Video --flags TABLE_HASH_KEY --key_type UInt32
|
25
|
+
.. table_create --name Tag --flags TABLE_HASH_KEY --key_type ShortText
|
26
|
+
.. column_create --table Video --name title --flags COLUMN_SCALAR --type ShortText
|
27
|
+
.. column_create --table Video --name tags --flags COLUMN_VECTOR --type Tag
|
28
|
+
.. column_create --table Tag --name index_tags --flags COLUMN_INDEX --type Video --source tags
|
29
|
+
.. load --table Video
|
30
|
+
.. [
|
31
|
+
.. {"_key":1,"title":"Soccer 2010","tags":["Sports","Soccer"]},
|
32
|
+
.. {"_key":2,"title":"Zenigata Kinjirou","tags":["Variety","Money"]},
|
33
|
+
.. {"_key":3,"title":"groonga Demo","tags":["IT","Server","groonga"]},
|
34
|
+
.. {"_key":4,"title":"Moero!! Ultra Baseball","tags":["Sports","Baseball"]},
|
35
|
+
.. {"_key":5,"title":"Hex Gone!","tags":["Variety","Quiz"]},
|
36
|
+
.. {"_key":6,"title":"Pikonyan 1","tags":["Animation","Pikonyan"]},
|
37
|
+
.. {"_key":7,"title":"Draw 8 Month","tags":["Animation","Raccoon"]},
|
38
|
+
.. {"_key":8,"title":"K.O.","tags":["Animation","Music"]}
|
39
|
+
.. ]
|
40
|
+
|
41
|
+
インデックスカラムを作成すると、全文検索が高速に行えるようになります。インデックスカラムは、対象のカラムに保存されたデータに更新があったとき、自動的に更新されます。
|
42
|
+
|
43
|
+
「ある語句が付与されている動画の一覧を取得する」検索を行いましょう。
|
44
|
+
|
45
|
+
.. groonga-command
|
46
|
+
.. include:: ../example/tutorial06-2.log
|
47
|
+
.. select --table Video --query tags:@Variety --output_columns _key,title
|
48
|
+
.. select --table Video --query tags:@Sports --output_columns _key,title
|
49
|
+
.. select --table Video --query tags:@Animation --output_columns _key,title
|
50
|
+
|
51
|
+
このように、「Variety」、「Sports」、「Animation」のようなタグで検索を行うことができました。
|
52
|
+
|
53
|
+
参照関係の逆引き
|
54
|
+
----------------
|
55
|
+
|
56
|
+
groongaはテーブル間の参照関係の逆引きを高速に行うためのインデックスを付与することができます。タグ検索は、その1例にすぎません。
|
57
|
+
|
58
|
+
例えば、ソーシャルネットワーキングサイトにおける友人関係を逆引き検索することができます。
|
59
|
+
|
60
|
+
以下の例では、ユーザー情報を格納するUserテーブルを作成し、ユーザー名を格納するusernameカラム、ユーザーの友人一覧を配列で格納するfriendsカラムとそのインデックスのindex_friendsカラムを追加しています。
|
61
|
+
|
62
|
+
.. groonga-command
|
63
|
+
.. include:: ../example/tutorial06-3.log
|
64
|
+
.. table_create --name User --flags TABLE_HASH_KEY --key_type ShortText
|
65
|
+
.. column_create --table User --name username --flags COLUMN_SCALAR --type ShortText
|
66
|
+
.. column_create --table User --name friends --flags COLUMN_VECTOR --type User
|
67
|
+
.. column_create --table User --name index_friends --flags COLUMN_INDEX --type User --source friends
|
68
|
+
.. load --table User
|
69
|
+
.. [
|
70
|
+
.. {"_key":"ken","username":"健作","friends":["taro","jiro","tomo","moritapo"]}
|
71
|
+
.. {"_key":"moritapo","username":"森田","friends":["ken","tomo"]}
|
72
|
+
.. {"_key":"taro","username":"ぐるんが太郎","friends":["jiro","tomo"]}
|
73
|
+
.. {"_key":"jiro","username":"ぐるんが次郎","friends":["taro","tomo"]}
|
74
|
+
.. {"_key":"tomo","username":"トモちゃん","friends":["ken","hana"]}
|
75
|
+
.. {"_key":"hana","username":"花子","friends":["ken","taro","jiro","moritapo","tomo"]}
|
76
|
+
.. ]
|
77
|
+
|
78
|
+
指定したユーザーを友人リストに入れているユーザーの一覧を表示してみましょう。
|
79
|
+
|
80
|
+
.. groonga-command
|
81
|
+
.. include:: ../example/tutorial06-4.log
|
82
|
+
.. select --table User --query friends:@tomo --output_columns _key,username
|
83
|
+
.. select --table User --query friends:@jiro --output_columns _key,username
|
84
|
+
|
85
|
+
さらに、ドリルダウンを使って、友人リストに入っている数の一覧を表示してみましょう。
|
86
|
+
|
87
|
+
.. groonga-command
|
88
|
+
.. include:: ../example/tutorial06-5.log
|
89
|
+
.. select --table User --limit 0 --drilldown friends
|
90
|
+
|
91
|
+
このように、テーブルの参照関係を逆にたどる検索ができました。
|
@@ -0,0 +1,92 @@
|
|
1
|
+
.. highlightlang:: none
|
2
|
+
|
3
|
+
.. groonga-command
|
4
|
+
.. table_remove Blog1
|
5
|
+
.. table_remove IndexBlog1
|
6
|
+
.. table_remove Blog2
|
7
|
+
.. table_remove IndexBlog2
|
8
|
+
|
9
|
+
match_columnsパラメータ
|
10
|
+
=======================
|
11
|
+
|
12
|
+
複数のカラムを対象とした全文検索
|
13
|
+
--------------------------------
|
14
|
+
|
15
|
+
groongaでは、複数のカラムを対象とした全文検索を行うことができます。例えば、ブログのテーブルで、タイトルと内容とがそれぞれ別のカラムに入ったものがあるとしましょう。「タイトルもしくは内容に特定の単語を含む」検索を行いたいとします。
|
16
|
+
|
17
|
+
この場合、2つのインデックス作成方式があります。1つは、それぞれのカラムに1つずつインデックスを付与する方式です。もう1つは、複数のカラムに対して1つのインデックスを付与する方式です。groongaでは、どちらの形式のインデックスが存在している場合でも、同一の記法で全文検索を行うことができます。
|
18
|
+
|
19
|
+
カラムごとにインデックスを付与する場合
|
20
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
21
|
+
|
22
|
+
Blog1テーブルを作り、タイトル文字列のtitleカラム、本文のmessageカラムを追加しています。
|
23
|
+
インデックス用のIndexBlog1テーブルも作り、titleカラムのインデックス用にindex_titleカラム、messageカラムのインデック用にindex_messageカラムと、それぞれ1カラムごとに1つずつ追加しています。
|
24
|
+
|
25
|
+
.. groonga-command
|
26
|
+
.. include:: ../example/tutorial07-1.log
|
27
|
+
.. table_create --name Blog1 --flags TABLE_HASH_KEY --key_type ShortText
|
28
|
+
.. column_create --table Blog1 --name title --flags COLUMN_SCALAR --type ShortText
|
29
|
+
.. column_create --table Blog1 --name message --flags COLUMN_SCALAR --type ShortText
|
30
|
+
.. table_create --name IndexBlog1 --flags TABLE_PAT_KEY|KEY_NORMALIZE --key_type ShortText --default_tokenizer TokenBigram
|
31
|
+
.. column_create --table IndexBlog1 --name index_title --flags COLUMN_INDEX|WITH_POSITION --type Blog1 --source title
|
32
|
+
.. column_create --table IndexBlog1 --name index_message --flags COLUMN_INDEX|WITH_POSITION --type Blog1 --source message
|
33
|
+
.. load --table Blog1
|
34
|
+
.. [
|
35
|
+
.. {"_key":"grn1","title":"groonga test","message":"groonga message"},
|
36
|
+
.. {"_key":"grn2","title":"baseball result","message":"rakutan eggs 4 - 4 groonga moritars"},
|
37
|
+
.. {"_key":"grn3","title":"groonga message","message":"none"}
|
38
|
+
.. ]
|
39
|
+
|
40
|
+
match_columnsオプションで、検索対象のカラムを複数指定することが出来ます。検索する文字列はqueryオプションで指定します。これを使うことで、タイトルと本文を全文検索することができます。
|
41
|
+
|
42
|
+
実際に検索してみましょう。
|
43
|
+
|
44
|
+
.. groonga-command
|
45
|
+
.. include:: ../example/tutorial07-2.log
|
46
|
+
.. select --table Blog1 --match_columns title||message --query groonga
|
47
|
+
.. select --table Blog1 --match_columns title||message --query message
|
48
|
+
.. select --table Blog1 --match_columns title --query message
|
49
|
+
|
50
|
+
複数のカラムにまたがったインデックスを付与する場合
|
51
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
52
|
+
|
53
|
+
内容は上の例とほぼ同じですが、titleとmessageの2つのカラムに対するインデックスが共通になっており、インデックスカラムが1つしかありません。
|
54
|
+
|
55
|
+
共通のインデックスを用いても、titleカラムのみでの検索、messageカラムのみでの検索、titleもしくはmessageカラムでの検索、全ての検索を行うことができます。
|
56
|
+
|
57
|
+
|
58
|
+
.. groonga-command
|
59
|
+
.. include:: ../example/tutorial07-3.log
|
60
|
+
.. table_create --name Blog2 --flags TABLE_HASH_KEY --key_type ShortText
|
61
|
+
.. column_create --table Blog2 --name title --flags COLUMN_SCALAR --type ShortText
|
62
|
+
.. column_create --table Blog2 --name message --flags COLUMN_SCALAR --type ShortText
|
63
|
+
.. table_create --name IndexBlog2 --flags TABLE_PAT_KEY|KEY_NORMALIZE --key_type ShortText --default_tokenizer TokenBigram
|
64
|
+
.. column_create --table IndexBlog2 --name index_blog --flags COLUMN_INDEX|WITH_POSITION|WITH_SECTION --type Blog2 --source title,message
|
65
|
+
.. load --table Blog2
|
66
|
+
.. [
|
67
|
+
.. {"_key":"grn1","title":"groonga test","message":"groonga message"},
|
68
|
+
.. {"_key":"grn2","title":"baseball result","message":"rakutan eggs 4 - 4 groonga moritars"},
|
69
|
+
.. {"_key":"grn3","title":"groonga message","message":"none"}
|
70
|
+
.. ]
|
71
|
+
|
72
|
+
実際に検索してみましょう。結果は上の例と同じになります。
|
73
|
+
|
74
|
+
.. groonga-command
|
75
|
+
.. include:: ../example/tutorial07-4.log
|
76
|
+
.. select --table Blog2 --match_columns title||message --query groonga
|
77
|
+
.. select --table Blog2 --match_columns title||message --query message
|
78
|
+
.. select --table Blog2 --match_columns title --query message
|
79
|
+
|
80
|
+
インデックス名を指定した全文検索
|
81
|
+
--------------------------------
|
82
|
+
|
83
|
+
執筆中です。
|
84
|
+
|
85
|
+
.. TODO: match_columnsにインデックス名を指定しての検索についても触れる。
|
86
|
+
|
87
|
+
インデックスの重み
|
88
|
+
------------------
|
89
|
+
|
90
|
+
執筆中です。
|
91
|
+
|
92
|
+
.. TODO: match_columnsの重み指定機能についても触れる。
|
@@ -0,0 +1,53 @@
|
|
1
|
+
.. highlightlang:: none
|
2
|
+
|
3
|
+
.. groonga-command
|
4
|
+
.. table_remove PatPre
|
5
|
+
|
6
|
+
主キーによる前方一致検索
|
7
|
+
========================
|
8
|
+
|
9
|
+
groongaのテーブルは、テーブル作成時にパトリシア木オプションを指定すると、前方一致検索を行うことができます。また、追加のオプションを指定することにより、主キーの後方一致検索をも行うことができます。
|
10
|
+
|
11
|
+
主キーによる前方一致検索
|
12
|
+
------------------------
|
13
|
+
|
14
|
+
table_createコマンドのflagsオプションにTABLE_PAT_KEYを指定することで、主キーによる前方一致検索ができるようになります。
|
15
|
+
|
16
|
+
.. groonga-command
|
17
|
+
.. include:: ../example/tutorial08-1.log
|
18
|
+
..
|
19
|
+
table_create --name PatPre --flags TABLE_PAT_KEY --key_type ShortText
|
20
|
+
load --table PatPre
|
21
|
+
[
|
22
|
+
{"_key":"ひろゆき"},
|
23
|
+
{"_key":"まろゆき"},
|
24
|
+
{"_key":"ひろあき"}
|
25
|
+
]
|
26
|
+
select --table PatPre --query _key:@ひろ
|
27
|
+
|
28
|
+
.. #主キーによる後方一致検索
|
29
|
+
.. #------------------------
|
30
|
+
.. #
|
31
|
+
.. #table_createコマンドのflagsオプションにTABLE_PAT_KEYとKEY_WITH_SISを指定することで、主キーによる前方一致検索・後方一致検索の両方が可能となります。
|
32
|
+
.. #
|
33
|
+
.. #KEY_WITH_SISフラグを付与すると、データを追加する際に後方一致用のレコードまで追加されてしまいます。カラムに
|
34
|
+
.. #
|
35
|
+
.. #そのレコードとの区別をつけるためにflagカラムを追加しています。
|
36
|
+
.. #
|
37
|
+
.. #実行例 ::
|
38
|
+
.. #
|
39
|
+
.. # > table_create --name PatSuf --flags TABLE_PAT_KEY|KEY_WITH_SIS --key_type ShortText
|
40
|
+
.. # [[0,1270635931.03862,0.00379]]
|
41
|
+
.. # > column_create --table PatSuf --name original --type UInt8
|
42
|
+
.. # [[0,1270635969.35514,0.013933]]
|
43
|
+
.. # > load --table PatSuf
|
44
|
+
.. # > [
|
45
|
+
.. # > {"_key":"ひろゆき","original":1},
|
46
|
+
.. # > {"_key":"まろゆき","original":1},
|
47
|
+
.. # > {"_key":"ひろあき","original":1}
|
48
|
+
.. # > ]
|
49
|
+
.. # [[0,1270635973.61015,0.062957],3]
|
50
|
+
.. # > select --table PatSuf --query _key:@ゆき
|
51
|
+
.. # [[0,1270635977.04008,0.000461],[[[4],[["_id","UInt32"],["_key","ShortText"],["original","UInt8"]],[1,"ひろゆき",1],[5,"まろゆき",1],[3,"ゆき",0],[2,"ろゆき",0]]]]
|
52
|
+
.. # > select --table PatSuf --query "_key:@ゆき + original:1"
|
53
|
+
.. # [[0,1270636044.85414,0.000443],[[[2],[["_id","UInt32"],["_key","ShortText"],["original","UInt8"]],[1,"ひろゆき",1],[5,"まろゆき",1]]]]
|
@@ -0,0 +1,486 @@
|
|
1
|
+
.. highlightlang:: none
|
2
|
+
|
3
|
+
.. groonga-command
|
4
|
+
.. table_remove Users
|
5
|
+
.. table_remove Comments
|
6
|
+
.. table_remove HashTags
|
7
|
+
.. table_remove Bigram
|
8
|
+
|
9
|
+
マイクロブログ検索システムの作成
|
10
|
+
================================
|
11
|
+
|
12
|
+
これまで学んだgroongaの機能を用いて、マイクロブログの検索システムを作成してみましょう。マイクロブログとは、Twitterのような短いメッセージを投稿するブログです。
|
13
|
+
|
14
|
+
テーブルの作成
|
15
|
+
--------------
|
16
|
+
|
17
|
+
まずは、テーブルを作成します。
|
18
|
+
|
19
|
+
::
|
20
|
+
|
21
|
+
table_create --name Users --flags TABLE_HASH_KEY --key_type ShortText
|
22
|
+
table_create --name Comments --flags TABLE_HASH_KEY --key_type ShortText
|
23
|
+
table_create --name HashTags --flags TABLE_HASH_KEY --key_type ShortText
|
24
|
+
table_create --name Bigram --flags TABLE_PAT_KEY|KEY_NORMALIZE --key_type ShortText --default_tokenizer TokenBigram
|
25
|
+
|
26
|
+
column_create --table Users --name name --flags COLUMN_SCALAR --type ShortText
|
27
|
+
column_create --table Users --name follower --flags COLUMN_VECTOR --type Users
|
28
|
+
column_create --table Users --name favorites --flags COLUMN_VECTOR --type Comments
|
29
|
+
column_create --table Users --name location --flags COLUMN_SCALAR --type WGS84GeoPoint
|
30
|
+
column_create --table Users --name location_str --flags COLUMN_SCALAR --type ShortText
|
31
|
+
column_create --table Users --name description --flags COLUMN_SCALAR --type ShortText
|
32
|
+
column_create --table Users --name folowee --flags COLUMN_INDEX --type Users --source follower
|
33
|
+
|
34
|
+
column_create --table Comments --name comment --flags COLUMN_SCALAR --type ShortText
|
35
|
+
column_create --table Comments --name last_modified --flags COLUMN_SCALAR --type Time
|
36
|
+
column_create --table Comments --name replied_to --flags COLUMN_SCALAR --type Comments
|
37
|
+
column_create --table Comments --name replied_users --flags COLUMN_VECTOR --type Users
|
38
|
+
column_create --table Comments --name hash_tags --flags COLUMN_VECTOR --type HashTags
|
39
|
+
column_create --table Comments --name location --flags COLUMN_SCALAR --type WGS84GeoPoint
|
40
|
+
column_create --table Comments --name posted_by --flags COLUMN_SCALAR --type Users
|
41
|
+
column_create --table Comments --name favorited_by --flags COLUMN_INDEX --type Users --source favorites
|
42
|
+
|
43
|
+
column_create --table HashTags --name hash_index --flags COLUMN_INDEX --type Comments --source hash_tags
|
44
|
+
|
45
|
+
column_create --table Bigram --name users_index --flags COLUMN_INDEX|WITH_POSITION|WITH_SECTION --type Users --source name,location_str,description
|
46
|
+
column_create --table Bigram --name comment_index --flags COLUMN_INDEX|WITH_POSITION --type Comments --source comment
|
47
|
+
|
48
|
+
Usersテーブル
|
49
|
+
^^^^^^^^^^^^^
|
50
|
+
|
51
|
+
ユーザーの名前や自己紹介文、フォローしているユーザー一覧など、ユーザー情報を格納するためのテーブルです。
|
52
|
+
|
53
|
+
``_key``
|
54
|
+
ユーザーID
|
55
|
+
|
56
|
+
``name``
|
57
|
+
ユーザー名
|
58
|
+
|
59
|
+
``follower``
|
60
|
+
フォローしているユーザーの一覧
|
61
|
+
|
62
|
+
``favorites``
|
63
|
+
お気に入りのコメント一覧
|
64
|
+
|
65
|
+
``location``
|
66
|
+
ユーザーの現在地(緯度経度座標)
|
67
|
+
|
68
|
+
``location_str``
|
69
|
+
ユーザーの現在地(文字列)
|
70
|
+
|
71
|
+
``description``
|
72
|
+
ユーザーの自己紹介
|
73
|
+
|
74
|
+
``folowee``
|
75
|
+
Usersテーブルのfollowerカラムに対するインデックス。
|
76
|
+
このインデックスを作ることで、あるユーザーをフォローしているユーザーを検索できるようになります。
|
77
|
+
|
78
|
+
Commentsテーブル
|
79
|
+
^^^^^^^^^^^^^^^^
|
80
|
+
|
81
|
+
コメント内容や投稿日時、返信先情報など、コメントに関する内容を格納するテーブルです。
|
82
|
+
|
83
|
+
``_key``
|
84
|
+
コメントID
|
85
|
+
|
86
|
+
``comment``
|
87
|
+
コメント内容
|
88
|
+
|
89
|
+
``last_modified``
|
90
|
+
投稿日時
|
91
|
+
|
92
|
+
``replied_to``
|
93
|
+
返信元のコメント内容
|
94
|
+
|
95
|
+
``replied_users``
|
96
|
+
返信先のユーザーの一覧
|
97
|
+
|
98
|
+
``hash_tags``
|
99
|
+
コメントのハッシュタグの一覧
|
100
|
+
|
101
|
+
``location``
|
102
|
+
投稿場所(緯度経度座標のため)
|
103
|
+
|
104
|
+
``posted_by``
|
105
|
+
コメントを書いたユーザー
|
106
|
+
|
107
|
+
``favorited_by``
|
108
|
+
Usersテーブルのfavoritesカラムに対するインデックス。
|
109
|
+
このインデックスを作ることで、指定したコメントを誰がお気に入りに入れているのかを検索できるようになります。
|
110
|
+
|
111
|
+
HashTagsテーブル
|
112
|
+
^^^^^^^^^^^^^^^^
|
113
|
+
|
114
|
+
コメントのハッシュタグを一覧で保存するためのテーブルです。
|
115
|
+
|
116
|
+
``_key``
|
117
|
+
ハッシュタグ
|
118
|
+
|
119
|
+
``hash_index``
|
120
|
+
「Comments.hash_tags」のインデックス。
|
121
|
+
このインデックスを作ることで、指定したハッシュタグのついているコメントの一覧を出すことが出来るようになります。
|
122
|
+
|
123
|
+
Bigramテーブル
|
124
|
+
^^^^^^^^^^^^^^
|
125
|
+
|
126
|
+
ユーザー情報・コメントで全文検索が出来るようにするためのインデックスを格納するテーブルです。
|
127
|
+
|
128
|
+
``_key``
|
129
|
+
単語
|
130
|
+
|
131
|
+
``users_index``
|
132
|
+
ユーザー情報のインデックス。
|
133
|
+
このカラムは、ユーザー名「Users.name」、現在地「Users.location_str」、自己紹介文「Users.description」のインデックスになっています。
|
134
|
+
|
135
|
+
``comment_index``
|
136
|
+
コメント内容「Comments.comment」のインデックス
|
137
|
+
|
138
|
+
データのロード
|
139
|
+
--------------
|
140
|
+
|
141
|
+
つづいて、テスト用データをロードします。
|
142
|
+
|
143
|
+
::
|
144
|
+
|
145
|
+
load --table Users
|
146
|
+
[
|
147
|
+
{
|
148
|
+
"_key": "daijiro",
|
149
|
+
"name": "hsiomaneki",
|
150
|
+
"follower": ["tasukuchan"],
|
151
|
+
"favorites": [],
|
152
|
+
"location": "127678039x502643091",
|
153
|
+
"location_str": "神奈川県",
|
154
|
+
"description": "groonga developer"
|
155
|
+
},
|
156
|
+
{
|
157
|
+
"_key": "tasukuchan",
|
158
|
+
"name": "グニャラくん",
|
159
|
+
"follower": ["daijiro","OffGao"],
|
160
|
+
"favorites": ["daijiro:1","OffGao:1"],
|
161
|
+
"location": "128423343x502929252",
|
162
|
+
"location_str": "東京都渋谷区",
|
163
|
+
"description": "エロいおっさん"
|
164
|
+
},
|
165
|
+
{
|
166
|
+
"_key": "OffGao",
|
167
|
+
"name": "OffGao",
|
168
|
+
"follower": ["tasukuchan","daijiro"],
|
169
|
+
"favorites": ["tasukuchan:1","daijiro:1"],
|
170
|
+
"location": "128544408x502801502",
|
171
|
+
"location_str": "東京都中野区",
|
172
|
+
"description": "がおがお"
|
173
|
+
}
|
174
|
+
]
|
175
|
+
|
176
|
+
load --table Comments
|
177
|
+
[
|
178
|
+
{
|
179
|
+
"_key": "daijiro:1",
|
180
|
+
"comment": "マイクロブログ作ってみました(甘栗むいちゃいました的な感じで)。",
|
181
|
+
"last_modified": "2010/03/17 12:05:00",
|
182
|
+
"posted_by": "daijiro",
|
183
|
+
},
|
184
|
+
{
|
185
|
+
"_key": "tasukuchan:1",
|
186
|
+
"comment": "初の書き込み。テストテスト。",
|
187
|
+
"last_modified": "2010/03/17 12:00:00",
|
188
|
+
"posted_by": "tasukuchan",
|
189
|
+
},
|
190
|
+
{
|
191
|
+
"_key": "daijiro:2",
|
192
|
+
"comment": "@tasukuchan ようこそ!!!",
|
193
|
+
"last_modified": "2010/03/17 12:05:00",
|
194
|
+
"replied_to": "tasukuchan:1",
|
195
|
+
"replied_users": ["tasukuchan"],
|
196
|
+
"posted_by": "daijiro",
|
197
|
+
},
|
198
|
+
{
|
199
|
+
"_key": "tasukuchan:2",
|
200
|
+
"comment": "@daijiro ありがとう!",
|
201
|
+
"last_modified": "2010/03/17 13:00:00",
|
202
|
+
"replied_to": "daijiro:2",
|
203
|
+
"replied_users": ["daijiro"],
|
204
|
+
"posted_by": "tasukuchan",
|
205
|
+
},
|
206
|
+
{
|
207
|
+
"_key": "tasukuchan:3",
|
208
|
+
"comment": "groongaなう #groonga",
|
209
|
+
"last_modified": "2010/03/17 14:00:00",
|
210
|
+
"hash_tags": ["groonga"],
|
211
|
+
"location": "127972422x503117107",
|
212
|
+
"posted_by": "tasukuchan",
|
213
|
+
},
|
214
|
+
{
|
215
|
+
"_key": "tasukuchan:4",
|
216
|
+
"comment": "groonga開発合宿のため羽田空港に来ました! #groonga #travel",
|
217
|
+
"last_modified": "2010/03/17 14:05:00",
|
218
|
+
"hash_tags": ["groonga", "travel"],
|
219
|
+
"location": "127975798x502919856",
|
220
|
+
"posted_by": "tasukuchan",
|
221
|
+
},
|
222
|
+
{
|
223
|
+
"_key": "OffGao:1",
|
224
|
+
"comment": "@daijiro @tasukuchan 登録してみましたよー!",
|
225
|
+
"last_modified": "2010/03/17 15:00:00",
|
226
|
+
"replied_users": ["daijiro", "tasukuchan"],
|
227
|
+
"location": "128551935x502796433",
|
228
|
+
"posted_by": "OffGao",
|
229
|
+
}
|
230
|
+
{
|
231
|
+
"_key": "OffGao:2",
|
232
|
+
"comment": "中野ブロードウェイなうなう",
|
233
|
+
"last_modified": "2010/03/17 15:05:00",
|
234
|
+
"location": "128551935x502796434",
|
235
|
+
"posted_by": "OffGao",
|
236
|
+
}
|
237
|
+
]
|
238
|
+
|
239
|
+
Usersテーブルのfollowerカラムとfavoritesカラム、そしてCommentsテーブルのreplied_usersカラムは、ベクターカラムです。そのため、これらのカラムは配列で値を指定します。
|
240
|
+
|
241
|
+
Usersテーブルのlocationカラムと、Commentsテーブルのlocationカラムは、GeoPoint型です。この型での値の指定は、"[緯度]x[経度]"と記述して指定します。
|
242
|
+
|
243
|
+
Commentsテーブルのlast_modifiedカラムは、Time型です。この型での値の指定方法は、マイクロ秒数の値を直接指定する方法のほかに、文字列で指定する方法もあります。"年/月/日 時:分:秒"というフォーマットで記述することで、データロードの際に文字列からキャストされ、マイクロ秒数の値が格納されます。
|
244
|
+
|
245
|
+
.. groonga-command
|
246
|
+
..
|
247
|
+
table_create --name Users --flags TABLE_HASH_KEY --key_type ShortText
|
248
|
+
table_create --name Comments --flags TABLE_HASH_KEY --key_type ShortText
|
249
|
+
table_create --name HashTags --flags TABLE_HASH_KEY --key_type ShortText
|
250
|
+
table_create --name Bigram --flags TABLE_PAT_KEY|KEY_NORMALIZE --key_type ShortText --default_tokenizer TokenBigram
|
251
|
+
|
252
|
+
column_create --table Users --name name --flags COLUMN_SCALAR --type ShortText
|
253
|
+
column_create --table Users --name follower --flags COLUMN_VECTOR --type Users
|
254
|
+
column_create --table Users --name favorites --flags COLUMN_VECTOR --type Comments
|
255
|
+
column_create --table Users --name location --flags COLUMN_SCALAR --type WGS84GeoPoint
|
256
|
+
column_create --table Users --name location_str --flags COLUMN_SCALAR --type ShortText
|
257
|
+
column_create --table Users --name description --flags COLUMN_SCALAR --type ShortText
|
258
|
+
column_create --table Users --name folowee --flags COLUMN_INDEX --type Users --source follower
|
259
|
+
|
260
|
+
column_create --table Comments --name comment --flags COLUMN_SCALAR --type ShortText
|
261
|
+
column_create --table Comments --name last_modified --flags COLUMN_SCALAR --type Time
|
262
|
+
column_create --table Comments --name replied_to --flags COLUMN_SCALAR --type Comments
|
263
|
+
column_create --table Comments --name replied_users --flags COLUMN_VECTOR --type Users
|
264
|
+
column_create --table Comments --name hash_tags --flags COLUMN_VECTOR --type HashTags
|
265
|
+
column_create --table Comments --name location --flags COLUMN_SCALAR --type WGS84GeoPoint
|
266
|
+
column_create --table Comments --name posted_by --flags COLUMN_SCALAR --type Users
|
267
|
+
column_create --table Comments --name favorited_by --flags COLUMN_INDEX --type Users --source favorites
|
268
|
+
|
269
|
+
column_create --table HashTags --name hash_index --flags COLUMN_INDEX --type Comments --source hash_tags
|
270
|
+
|
271
|
+
column_create --table Bigram --name users_index --flags COLUMN_INDEX|WITH_POSITION|WITH_SECTION --type Users --source name,location_str,description
|
272
|
+
column_create --table Bigram --name comment_index --flags COLUMN_INDEX|WITH_POSITION --type Comments --source comment
|
273
|
+
|
274
|
+
load --table Users
|
275
|
+
[
|
276
|
+
{
|
277
|
+
"_key": "daijiro",
|
278
|
+
"name": "hsiomaneki",
|
279
|
+
"follower": ["tasukuchan"],
|
280
|
+
"favorites": [],
|
281
|
+
"location": "127678039x502643091",
|
282
|
+
"location_str": "神奈川県",
|
283
|
+
"description": "groonga developer"
|
284
|
+
},
|
285
|
+
{
|
286
|
+
"_key": "tasukuchan",
|
287
|
+
"name": "グニャラくん",
|
288
|
+
"follower": ["daijiro","OffGao"],
|
289
|
+
"favorites": ["daijiro:1","OffGao:1"],
|
290
|
+
"location": "128423343x502929252",
|
291
|
+
"location_str": "東京都渋谷区",
|
292
|
+
"description": "エロいおっさん"
|
293
|
+
},
|
294
|
+
{
|
295
|
+
"_key": "OffGao",
|
296
|
+
"name": "OffGao",
|
297
|
+
"follower": ["tasukuchan","daijiro"],
|
298
|
+
"favorites": ["tasukuchan:1","daijiro:1"],
|
299
|
+
"location": "128544408x502801502",
|
300
|
+
"location_str": "東京都中野区",
|
301
|
+
"description": "がおがお"
|
302
|
+
}
|
303
|
+
]
|
304
|
+
|
305
|
+
load --table Comments
|
306
|
+
[
|
307
|
+
{
|
308
|
+
"_key": "daijiro:1",
|
309
|
+
"comment": "マイクロブログ作ってみました(甘栗むいちゃいました的な感じで)。",
|
310
|
+
"last_modified": "2010/03/17 12:05:00",
|
311
|
+
"posted_by": "daijiro",
|
312
|
+
},
|
313
|
+
{
|
314
|
+
"_key": "tasukuchan:1",
|
315
|
+
"comment": "初の書き込み。テストテスト。",
|
316
|
+
"last_modified": "2010/03/17 12:00:00",
|
317
|
+
"posted_by": "tasukuchan",
|
318
|
+
},
|
319
|
+
{
|
320
|
+
"_key": "daijiro:2",
|
321
|
+
"comment": "@tasukuchan ようこそ!!!",
|
322
|
+
"last_modified": "2010/03/17 12:05:00",
|
323
|
+
"replied_to": "tasukuchan:1",
|
324
|
+
"replied_users": ["tasukuchan"],
|
325
|
+
"posted_by": "daijiro",
|
326
|
+
},
|
327
|
+
{
|
328
|
+
"_key": "tasukuchan:2",
|
329
|
+
"comment": "@daijiro ありがとう!",
|
330
|
+
"last_modified": "2010/03/17 13:00:00",
|
331
|
+
"replied_to": "daijiro:2",
|
332
|
+
"replied_users": ["daijiro"],
|
333
|
+
"posted_by": "tasukuchan",
|
334
|
+
},
|
335
|
+
{
|
336
|
+
"_key": "tasukuchan:3",
|
337
|
+
"comment": "groongaなう #groonga",
|
338
|
+
"last_modified": "2010/03/17 14:00:00",
|
339
|
+
"hash_tags": ["groonga"],
|
340
|
+
"location": "127972422x503117107",
|
341
|
+
"posted_by": "tasukuchan",
|
342
|
+
},
|
343
|
+
{
|
344
|
+
"_key": "tasukuchan:4",
|
345
|
+
"comment": "groonga開発合宿のため羽田空港に来ました! #groonga #travel",
|
346
|
+
"last_modified": "2010/03/17 14:05:00",
|
347
|
+
"hash_tags": ["groonga", "travel"],
|
348
|
+
"location": "127975798x502919856",
|
349
|
+
"posted_by": "tasukuchan",
|
350
|
+
},
|
351
|
+
{
|
352
|
+
"_key": "OffGao:1",
|
353
|
+
"comment": "@daijiro @tasukuchan 登録してみましたよー!",
|
354
|
+
"last_modified": "2010/03/17 15:00:00",
|
355
|
+
"replied_users": ["daijiro", "tasukuchan"],
|
356
|
+
"location": "128551935x502796433",
|
357
|
+
"posted_by": "OffGao",
|
358
|
+
}
|
359
|
+
{
|
360
|
+
"_key": "OffGao:2",
|
361
|
+
"comment": "中野ブロードウェイなうなう",
|
362
|
+
"last_modified": "2010/03/17 15:05:00",
|
363
|
+
"location": "128551935x502796434",
|
364
|
+
"posted_by": "OffGao",
|
365
|
+
}
|
366
|
+
]
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
検索
|
371
|
+
----
|
372
|
+
|
373
|
+
それでは、実際に検索をしてみましょう。
|
374
|
+
|
375
|
+
キーワードでユーザー検索
|
376
|
+
^^^^^^^^^^^^^^^^^^^^^^^^
|
377
|
+
ここでは、 :doc:`tutorial07` で扱った、複数カラムを対象とした検索を行います。
|
378
|
+
指定された文字列で、ユーザー名・現在地・自己紹介文を対象に検索をします。
|
379
|
+
|
380
|
+
.. groonga-command
|
381
|
+
.. include:: ../example/tutorial10-1.log
|
382
|
+
.. select --table Users --match_columns name,location_str,description --query 東京 --output_columns _key,name
|
383
|
+
|
384
|
+
「東京」をキーワードにユーザー検索した結果、東京都に住んでいる「グニャラくん」と「OffGao」がヒットしました。
|
385
|
+
|
386
|
+
GeoPointでユーザー検索
|
387
|
+
^^^^^^^^^^^^^^^^^^^^^^
|
388
|
+
|
389
|
+
ここでは、 :doc:`tutorial04` で扱った、GeoPoint型のカラムで検索をします。
|
390
|
+
以下の例では、指定された位置から5000m以内にいるユーザーを検索しています。
|
391
|
+
|
392
|
+
.. groonga-command
|
393
|
+
.. include:: ../example/tutorial10-2.log
|
394
|
+
.. select --table Users --filter 'geo_in_circle(location,"128484216x502919856",5000)' --output_columns _key,name
|
395
|
+
|
396
|
+
新宿駅から5km以内にすんでいるユーザーを検索したところ、「グニャラくん」と「OffGao」がヒットしました。
|
397
|
+
|
398
|
+
あるユーザーをフォローしているユーザーの検索
|
399
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
400
|
+
|
401
|
+
ここでは、 :doc:`tutorial06` で扱った、参照関係の逆引きをします。
|
402
|
+
以下の例では、Usersテーブルのfollowerカラムにあるフォローリストを逆引きします。
|
403
|
+
|
404
|
+
.. groonga-command
|
405
|
+
.. include:: ../example/tutorial10-3.log
|
406
|
+
.. select --table Users --query follower:@tasukuchan --output_columns _key,name
|
407
|
+
|
408
|
+
「グニャラくん」をフォローしている「hsiomaneki」と「OffGao」がヒットしました。
|
409
|
+
|
410
|
+
GeoPointでコメント検索
|
411
|
+
^^^^^^^^^^^^^^^^^^^^^^
|
412
|
+
ある範囲内で書かれたコメントを検索します。
|
413
|
+
また、 :doc:`tutorial05` で扱ったドリルダウンも行います。検索結果をハッシュタグとユーザーでドリルダウンし、ユーザー別・ハッシュタグ別のカウントを出します。
|
414
|
+
|
415
|
+
.. groonga-command
|
416
|
+
.. include:: ../example/tutorial10-4.log
|
417
|
+
.. select --table Comments --filter 'geo_in_circle(location,"127975798x502919856",20000)' --output_columns posted_by.name,comment --drilldown hash_tags,posted_by
|
418
|
+
|
419
|
+
範囲を広く指定したため、位置情報のあるすべてのコメントがヒットしました。そして、ヒットしたコメントからドリルダウンされた結果も返ってきており、ハッシュタグは「#groonga」が2つに「#travel」が1つ、投稿者は「グニャラくん」「OffGao」がそれぞれ2件ずつであることがわかります。
|
420
|
+
|
421
|
+
キーワードでコメント検索
|
422
|
+
^^^^^^^^^^^^^^^^^^^^^^^^
|
423
|
+
あるキーワードを含むコメントを検索します。
|
424
|
+
さらに、 :doc:`tutorial04` で扱った、スコア値_scoreも出してみましょう。
|
425
|
+
|
426
|
+
.. groonga-command
|
427
|
+
.. include:: ../example/tutorial10-5.log
|
428
|
+
.. select --table Comments --query comment:@なう --output_columns comment,_score
|
429
|
+
|
430
|
+
「なう」をキーワードにコメント検索した結果、2件のコメントがヒットしました。また、_scoreの値も返ってきており、「なう」の数が出力されていることが確認できます。
|
431
|
+
|
432
|
+
GeoPointとキーワードでコメント検索
|
433
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
434
|
+
今度は、キーワードとGeoPointの両方を条件に検索をしてみます。--queryと--filterの両方を使用した場合、両方の条件に一致するレコードがヒットします。
|
435
|
+
|
436
|
+
.. groonga-command
|
437
|
+
.. include:: ../example/tutorial10-6.log
|
438
|
+
.. select --table Comments --query comment:@羽田 --filter 'geo_in_circle(location,"127975798x502919856",20000)' --output_columns posted_by.name,comment --drilldown hash_tags,posted_by
|
439
|
+
|
440
|
+
両方の条件を満たすコメントが1件ヒットしました。また、ドリルダウンの結果も返ってきており、「グニャラくん」のコメント1件であることがわかります。
|
441
|
+
|
442
|
+
ハッシュタグでコメント検索
|
443
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
444
|
+
あるハッシュタグのついているコメントを検索します。
|
445
|
+
これも、 :doc:`tutorial06` で扱った、参照関係の逆引きを使います。
|
446
|
+
|
447
|
+
.. groonga-command
|
448
|
+
.. include:: ../example/tutorial10-7.log
|
449
|
+
.. select --table Comments --query hash_tags:@groonga --output_columns posted_by.name,comment --drilldown posted_by
|
450
|
+
|
451
|
+
#groongaタグの付いている2件のコメントがヒットしました。また、投稿者のドリルダウンも返ってきており、2件とも「グニャラくん」のものであることがわかります。
|
452
|
+
|
453
|
+
ユーザーIDでコメント検索
|
454
|
+
^^^^^^^^^^^^^^^^^^^^^^^^
|
455
|
+
あるユーザーが投稿したコメントを検索します。
|
456
|
+
|
457
|
+
.. groonga-command
|
458
|
+
.. include:: ../example/tutorial10-8.log
|
459
|
+
.. select --table Comments --query posted_by:tasukuchan --output_columns comment --drilldown hash_tags
|
460
|
+
|
461
|
+
「グニャラくん」が書き込んだ4件のコメントがヒットしました。また、ハッシュタグでドリルダウンした結果も返ってきており、ハッシュタグは「#groonga」が2つに「#travel」が1つあることがわかります。
|
462
|
+
|
463
|
+
ユーザーのお気に入りコメントを検索
|
464
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
465
|
+
あるユーザーがお気に入りに入れているコメントを検索します。
|
466
|
+
|
467
|
+
.. groonga-command
|
468
|
+
.. include:: ../example/tutorial10-9.log
|
469
|
+
.. select --table Users --query _key:tasukuchan --output_columns favorites.posted_by,favorites.comment
|
470
|
+
|
471
|
+
「グニャラくん」がお気に入りに入れている2件のコメントがヒットしました。
|
472
|
+
|
473
|
+
投稿時間でコメント検索
|
474
|
+
^^^^^^^^^^^^^^^^^^^^^^
|
475
|
+
コメントの投稿時間で検索をします。Time型については :doc:`tutorial03` で扱っています。
|
476
|
+
この例では、指定した時間よりも前に投稿されているコメントを検索します。
|
477
|
+
|
478
|
+
.. groonga-command
|
479
|
+
.. include:: ../example/tutorial10-10.log
|
480
|
+
.. select Comments --filter 'last_modified<=1268802000' --output_columns posted_by.name,comment,last_modified --drilldown hash_tags,posted_by
|
481
|
+
|
482
|
+
2010/03/17 14:00:00以前に書かれたコメント5件がヒットしました。また、ドリルダウンの結果も返ってきており、「hsiomaneki」が2件、「グニャラくん」が3件ヒットしていることがわかります。
|
483
|
+
|
484
|
+
.. TODO: 以下の機能はgroonga本体での支援が必要。
|
485
|
+
.. タイムライン表示: あるユーザがfollowしているユーザの発言を、時系列順の逆順で並べて10件のみ表示。
|
486
|
+
.. 複数の条件での検索: favoriteの数がn以上の発言で全文検索、さらにユーザでドリルダウン
|