rroonga 3.0.1-x86-mingw32 → 3.0.2-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/text/news.textile +21 -0
- data/ext/groonga/rb-grn-index-column.c +353 -1
- data/ext/groonga/rb-grn-object.c +529 -495
- data/ext/groonga/rb-grn-table.c +48 -0
- data/ext/groonga/rb-grn-utils.c +585 -418
- data/ext/groonga/rb-grn.h +6 -4
- data/lib/1.9/groonga.so +0 -0
- data/lib/2.0/groonga.so +0 -0
- data/lib/groonga/dumper.rb +25 -8
- data/lib/groonga/record.rb +21 -2
- data/lib/groonga/schema.rb +2 -2
- data/rroonga-build.rb +1 -1
- data/rroonga.gemspec +2 -0
- data/test/test-database-dumper.rb +45 -3
- data/test/test-expression-builder.rb +0 -13
- data/test/test-fix-size-column.rb +40 -9
- data/test/test-index-column.rb +130 -1
- data/test/test-record.rb +43 -8
- data/test/test-schema-create-table.rb +2 -2
- data/test/test-schema-dumper.rb +46 -6
- data/test/test-table.rb +4 -3
- data/test/test-variable-size-column.rb +115 -26
- data/vendor/local/bin/groonga-benchmark.exe +0 -0
- data/vendor/local/bin/groonga.exe +0 -0
- data/vendor/local/bin/libgcc_s_sjlj-1.dll +0 -0
- data/vendor/local/bin/libgroonga-0.dll +0 -0
- data/vendor/local/bin/libmecab-1.dll +0 -0
- data/vendor/local/bin/libmsgpack-3.dll +0 -0
- data/vendor/local/bin/libmsgpackc-2.dll +0 -0
- data/vendor/local/bin/libstdc++-6.dll +0 -0
- data/vendor/local/bin/mecab.exe +0 -0
- data/vendor/local/include/groonga/groonga.h +1 -9
- data/vendor/local/lib/groonga/plugins/query_expanders/tsv.a +0 -0
- data/vendor/local/lib/groonga/plugins/query_expanders/tsv.dll +0 -0
- data/vendor/local/lib/groonga/plugins/query_expanders/tsv.dll.a +0 -0
- data/vendor/local/lib/groonga/plugins/query_expanders/tsv.la +1 -1
- data/vendor/local/lib/groonga/plugins/suggest/suggest.a +0 -0
- data/vendor/local/lib/groonga/plugins/suggest/suggest.dll +0 -0
- data/vendor/local/lib/groonga/plugins/suggest/suggest.dll.a +0 -0
- data/vendor/local/lib/groonga/plugins/suggest/suggest.la +1 -1
- data/vendor/local/lib/groonga/plugins/table/table.a +0 -0
- data/vendor/local/lib/groonga/plugins/table/table.dll +0 -0
- data/vendor/local/lib/groonga/plugins/table/table.dll.a +0 -0
- data/vendor/local/lib/groonga/plugins/table/table.la +1 -1
- data/vendor/local/lib/groonga/plugins/tokenizers/mecab.a +0 -0
- data/vendor/local/lib/groonga/plugins/tokenizers/mecab.dll +0 -0
- data/vendor/local/lib/groonga/plugins/tokenizers/mecab.dll.a +0 -0
- data/vendor/local/lib/groonga/plugins/tokenizers/mecab.la +1 -1
- data/vendor/local/lib/libgroonga.a +0 -0
- data/vendor/local/lib/libgroonga.dll.a +0 -0
- data/vendor/local/lib/libgroonga.la +1 -1
- data/vendor/local/lib/libmecab.a +0 -0
- data/vendor/local/lib/libmecab.dll.a +0 -0
- data/vendor/local/lib/libmsgpack.a +0 -0
- data/vendor/local/lib/libmsgpack.dll.a +0 -0
- data/vendor/local/lib/libmsgpack.la +1 -1
- data/vendor/local/lib/libmsgpackc.a +0 -0
- data/vendor/local/lib/libmsgpackc.dll.a +0 -0
- data/vendor/local/lib/libmsgpackc.la +1 -1
- data/vendor/local/lib/pkgconfig/groonga.pc +2 -2
- data/vendor/local/libexec/mecab/mecab-cost-train.exe +0 -0
- data/vendor/local/libexec/mecab/mecab-dict-gen.exe +0 -0
- data/vendor/local/libexec/mecab/mecab-dict-index.exe +0 -0
- data/vendor/local/libexec/mecab/mecab-system-eval.exe +0 -0
- data/vendor/local/libexec/mecab/mecab-test-gen.exe +0 -0
- data/vendor/local/share/doc/groonga/en/html/.buildinfo +1 -1
- data/vendor/local/share/doc/groonga/en/html/_sources/install/centos.txt +3 -3
- data/vendor/local/share/doc/groonga/en/html/_sources/install/debian.txt +43 -3
- data/vendor/local/share/doc/groonga/en/html/_sources/install/fedora.txt +3 -3
- data/vendor/local/share/doc/groonga/en/html/_sources/install/mac_os_x.txt +3 -3
- data/vendor/local/share/doc/groonga/en/html/_sources/install/others.txt +3 -3
- data/vendor/local/share/doc/groonga/en/html/_sources/install/solaris.txt +3 -3
- data/vendor/local/share/doc/groonga/en/html/_sources/install/ubuntu.txt +3 -50
- data/vendor/local/share/doc/groonga/en/html/_sources/install/windows.txt +11 -21
- data/vendor/local/share/doc/groonga/en/html/_sources/news.txt +51 -0
- data/vendor/local/share/doc/groonga/en/html/_sources/reference/api/grn_ctx.txt +49 -0
- data/vendor/local/share/doc/groonga/en/html/_sources/reference/api.txt +8 -1
- data/vendor/local/share/doc/groonga/en/html/_sources/reference/commands/tokenize.txt +196 -0
- data/vendor/local/share/doc/groonga/en/html/_sources/reference/normalizers.txt +1 -1
- data/vendor/local/share/doc/groonga/en/html/_sources/reference/tokenizers.txt +16 -0
- data/vendor/local/share/doc/groonga/en/html/_static/pygments.css +2 -2
- data/vendor/local/share/doc/groonga/en/html/characteristic.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/community.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/contribution/development/com.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/contribution/development/document.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/contribution/development/query.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/contribution/development/release.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/contribution/development/repository.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/contribution/development/test.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/contribution/development.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/contribution/documentation/c-api.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/contribution/documentation/i18n.html +13 -5
- data/vendor/local/share/doc/groonga/en/html/contribution/documentation.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/contribution/report.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/contribution.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/development/travis-ci.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/development.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/genindex.html +22 -5
- data/vendor/local/share/doc/groonga/en/html/geolocation_search.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/index.html +19 -14
- data/vendor/local/share/doc/groonga/en/html/install/centos.html +8 -8
- data/vendor/local/share/doc/groonga/en/html/install/debian.html +48 -12
- data/vendor/local/share/doc/groonga/en/html/install/fedora.html +8 -8
- data/vendor/local/share/doc/groonga/en/html/install/mac_os_x.html +8 -8
- data/vendor/local/share/doc/groonga/en/html/install/others.html +8 -8
- data/vendor/local/share/doc/groonga/en/html/install/solaris.html +8 -8
- data/vendor/local/share/doc/groonga/en/html/install/ubuntu.html +16 -60
- data/vendor/local/share/doc/groonga/en/html/install/windows.html +16 -25
- data/vendor/local/share/doc/groonga/en/html/install.html +12 -12
- data/vendor/local/share/doc/groonga/en/html/limitations.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/news/0.x.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/news/1.0.x.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/news/1.1.x.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/news/1.2.x.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/news/senna.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/news.html +187 -129
- data/vendor/local/share/doc/groonga/en/html/objects.inv +0 -0
- data/vendor/local/share/doc/groonga/en/html/reference/api/grn_ctx.html +198 -0
- data/vendor/local/share/doc/groonga/en/html/reference/api/grn_expr.html +31 -6
- data/vendor/local/share/doc/groonga/en/html/reference/api.html +18 -11
- data/vendor/local/share/doc/groonga/en/html/reference/cast.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/command/command_version.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/command/output_format.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/command/return_code.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/command.html +7 -6
- data/vendor/local/share/doc/groonga/en/html/reference/commands/cache_limit.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/check.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/clearlock.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/column_create.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/column_list.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/column_remove.html +17 -17
- data/vendor/local/share/doc/groonga/en/html/reference/commands/column_rename.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/define_selector.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/defrag.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/delete.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/dump.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/load.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/log_level.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/log_put.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/log_reopen.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/normalize.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/quit.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/register.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/select.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/shutdown.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/status.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/suggest.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/table_create.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/table_list.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands/table_remove.html +10 -10
- data/vendor/local/share/doc/groonga/en/html/reference/commands/tokenize.html +310 -0
- data/vendor/local/share/doc/groonga/en/html/reference/commands/truncate.html +26 -26
- data/vendor/local/share/doc/groonga/en/html/reference/commands_not_implemented/add.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands_not_implemented/get.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/commands_not_implemented/set.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/executables/grnslap.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/executables/grntest.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-httpd.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-server-http.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-suggest-create-dataset.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/executables.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/function.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/functions/edit_distance.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/functions/geo_distance.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/functions/geo_in_circle.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/functions/geo_in_rectangle.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/functions/now.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/functions/query.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/functions/rand.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/functions/snippet_html.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/functions/sub_filter.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/grn_expr/query_syntax.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/grn_expr/script_syntax.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/grn_expr.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/indexing.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/log.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/normalizers.html +6 -6
- data/vendor/local/share/doc/groonga/en/html/reference/output.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/pseudo_column.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/query_expanders/tsv.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/query_expanders.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/tables.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/reference/tokenizers.html +20 -5
- data/vendor/local/share/doc/groonga/en/html/reference/types.html +9 -9
- data/vendor/local/share/doc/groonga/en/html/reference.html +12 -7
- data/vendor/local/share/doc/groonga/en/html/search.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/searchindex.js +1 -1
- data/vendor/local/share/doc/groonga/en/html/server/gqtp.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/server/http/comparison.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/server/http/groonga-httpd.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/server/http/groonga.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/server/http.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/server/package.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/server.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/spec/gqtp.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/spec/search.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/spec.html +10 -10
- data/vendor/local/share/doc/groonga/en/html/suggest/completion.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/suggest/correction.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/suggest/introduction.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/suggest/suggestion.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/suggest/tutorial.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/suggest.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/troubleshooting/different_results_with_the_same_keyword.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/troubleshooting.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial/data.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial/drilldown.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial/index.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial/introduction.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial/lexicon.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial/match_columns.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial/micro_blog.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial/network.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial/patricia_trie.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial/query_expansion.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial/search.html +5 -5
- data/vendor/local/share/doc/groonga/en/html/tutorial.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/.buildinfo +1 -1
- data/vendor/local/share/doc/groonga/ja/html/_sources/install/centos.txt +3 -3
- data/vendor/local/share/doc/groonga/ja/html/_sources/install/debian.txt +43 -3
- data/vendor/local/share/doc/groonga/ja/html/_sources/install/fedora.txt +3 -3
- data/vendor/local/share/doc/groonga/ja/html/_sources/install/mac_os_x.txt +3 -3
- data/vendor/local/share/doc/groonga/ja/html/_sources/install/others.txt +3 -3
- data/vendor/local/share/doc/groonga/ja/html/_sources/install/solaris.txt +3 -3
- data/vendor/local/share/doc/groonga/ja/html/_sources/install/ubuntu.txt +3 -50
- data/vendor/local/share/doc/groonga/ja/html/_sources/install/windows.txt +11 -21
- data/vendor/local/share/doc/groonga/ja/html/_sources/news.txt +51 -0
- data/vendor/local/share/doc/groonga/ja/html/_sources/reference/api/grn_ctx.txt +49 -0
- data/vendor/local/share/doc/groonga/ja/html/_sources/reference/api.txt +8 -1
- data/vendor/local/share/doc/groonga/ja/html/_sources/reference/commands/tokenize.txt +196 -0
- data/vendor/local/share/doc/groonga/ja/html/_sources/reference/normalizers.txt +1 -1
- data/vendor/local/share/doc/groonga/ja/html/_sources/reference/tokenizers.txt +16 -0
- data/vendor/local/share/doc/groonga/ja/html/_static/pygments.css +2 -2
- data/vendor/local/share/doc/groonga/ja/html/characteristic.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/community.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/contribution/development/com.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/contribution/development/document.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/contribution/development/query.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/contribution/development/release.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/contribution/development/repository.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/contribution/development/test.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/contribution/development.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/contribution/documentation/c-api.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/contribution/documentation/i18n.html +17 -9
- data/vendor/local/share/doc/groonga/ja/html/contribution/documentation.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/contribution/report.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/contribution.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/development/travis-ci.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/development.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/genindex.html +31 -7
- data/vendor/local/share/doc/groonga/ja/html/geolocation_search.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/index.html +19 -14
- data/vendor/local/share/doc/groonga/ja/html/install/centos.html +8 -8
- data/vendor/local/share/doc/groonga/ja/html/install/debian.html +44 -12
- data/vendor/local/share/doc/groonga/ja/html/install/fedora.html +8 -8
- data/vendor/local/share/doc/groonga/ja/html/install/mac_os_x.html +8 -8
- data/vendor/local/share/doc/groonga/ja/html/install/others.html +8 -8
- data/vendor/local/share/doc/groonga/ja/html/install/solaris.html +8 -8
- data/vendor/local/share/doc/groonga/ja/html/install/ubuntu.html +16 -56
- data/vendor/local/share/doc/groonga/ja/html/install/windows.html +16 -25
- data/vendor/local/share/doc/groonga/ja/html/install.html +12 -12
- data/vendor/local/share/doc/groonga/ja/html/limitations.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/news/0.x.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/news/1.0.x.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/news/1.1.x.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/news/1.2.x.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/news/senna.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/news.html +178 -129
- data/vendor/local/share/doc/groonga/ja/html/objects.inv +0 -0
- data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_ctx.html +195 -0
- data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_expr.html +31 -6
- data/vendor/local/share/doc/groonga/ja/html/reference/api.html +17 -11
- data/vendor/local/share/doc/groonga/ja/html/reference/cast.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/command/command_version.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/command/output_format.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/command/return_code.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/command.html +7 -6
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/cache_limit.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/check.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/clearlock.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_create.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_list.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_remove.html +17 -17
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_rename.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/define_selector.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/defrag.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/delete.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/dump.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/load.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/log_level.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/log_put.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/log_reopen.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/normalize.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/quit.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/register.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/select.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/shutdown.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/status.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/suggest.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/table_create.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/table_list.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/table_remove.html +10 -10
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/tokenize.html +311 -0
- data/vendor/local/share/doc/groonga/ja/html/reference/commands/truncate.html +26 -26
- data/vendor/local/share/doc/groonga/ja/html/reference/commands_not_implemented/add.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands_not_implemented/get.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/commands_not_implemented/set.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/executables/grnslap.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/executables/grntest.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-httpd.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-server-http.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-suggest-create-dataset.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/executables.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/function.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/functions/edit_distance.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/functions/geo_distance.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/functions/geo_in_circle.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/functions/geo_in_rectangle.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/functions/now.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/functions/query.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/functions/rand.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/functions/snippet_html.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/functions/sub_filter.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/grn_expr/query_syntax.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/grn_expr/script_syntax.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/grn_expr.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/indexing.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/log.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/normalizers.html +6 -6
- data/vendor/local/share/doc/groonga/ja/html/reference/output.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/pseudo_column.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/query_expanders/tsv.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/query_expanders.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/tables.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/tokenizers.html +20 -5
- data/vendor/local/share/doc/groonga/ja/html/reference/types.html +9 -9
- data/vendor/local/share/doc/groonga/ja/html/reference.html +12 -7
- data/vendor/local/share/doc/groonga/ja/html/search.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/searchindex.js +1 -1
- data/vendor/local/share/doc/groonga/ja/html/server/gqtp.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/server/http/comparison.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/server/http/groonga-httpd.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/server/http/groonga.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/server/http.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/server/package.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/server.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/spec/gqtp.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/spec/search.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/spec.html +10 -10
- data/vendor/local/share/doc/groonga/ja/html/suggest/completion.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/suggest/correction.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/suggest/introduction.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/suggest/suggestion.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/suggest/tutorial.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/suggest.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/troubleshooting/different_results_with_the_same_keyword.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/troubleshooting.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial/data.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial/drilldown.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial/index.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial/introduction.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial/lexicon.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial/match_columns.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial/micro_blog.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial/network.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial/patricia_trie.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial/query_expansion.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial/search.html +5 -5
- data/vendor/local/share/doc/groonga/ja/html/tutorial.html +5 -5
- data/vendor/local/share/man/ja/man1/groonga.1 +3227 -197
- data/vendor/local/share/man/man1/groonga.1 +3230 -195
- metadata +131 -123
data/ext/groonga/rb-grn-utils.c
CHANGED
@@ -102,13 +102,13 @@ rb_grn_scan_options (VALUE options, ...)
|
|
102
102
|
|
103
103
|
options = rb_grn_check_convert_to_hash(options);
|
104
104
|
if (NIL_P(options)) {
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
105
|
+
if (NIL_P(original_options)) {
|
106
|
+
options = rb_hash_new();
|
107
|
+
} else {
|
108
|
+
rb_raise(rb_eArgError,
|
109
|
+
"options must be Hash: %s",
|
110
|
+
rb_grn_inspect(original_options));
|
111
|
+
}
|
112
112
|
} else if (options == original_options) {
|
113
113
|
options = rb_funcall(options, rb_intern("dup"), 0);
|
114
114
|
}
|
@@ -144,11 +144,11 @@ rb_grn_equal_option (VALUE option, const char *key)
|
|
144
144
|
|
145
145
|
key_string = rb_str_new2(key);
|
146
146
|
if (RVAL2CBOOL(rb_funcall(option, rb_intern("=="), 1, key_string)))
|
147
|
-
|
147
|
+
return GRN_TRUE;
|
148
148
|
|
149
149
|
key_symbol = rb_str_intern(key_string);
|
150
150
|
if (RVAL2CBOOL(rb_funcall(option, rb_intern("=="), 1, key_symbol)))
|
151
|
-
|
151
|
+
return GRN_TRUE;
|
152
152
|
|
153
153
|
return GRN_FALSE;
|
154
154
|
}
|
@@ -193,69 +193,69 @@ rb_grn_check_convert_to_hash (VALUE object)
|
|
193
193
|
|
194
194
|
static VALUE
|
195
195
|
rb_grn_bulk_to_ruby_object_by_range_id (grn_ctx *context, grn_obj *bulk,
|
196
|
-
|
197
|
-
|
196
|
+
grn_id range_id,
|
197
|
+
VALUE related_object, VALUE *rb_value)
|
198
198
|
{
|
199
199
|
grn_bool success = GRN_TRUE;
|
200
200
|
|
201
201
|
switch (range_id) {
|
202
202
|
case GRN_DB_VOID:
|
203
|
-
|
204
|
-
|
203
|
+
*rb_value = rb_str_new(GRN_TEXT_VALUE(bulk), GRN_TEXT_LEN(bulk));
|
204
|
+
break;
|
205
205
|
case GRN_DB_BOOL:
|
206
|
-
|
207
|
-
|
206
|
+
*rb_value = GRN_BOOL_VALUE(bulk) ? Qtrue : Qfalse;
|
207
|
+
break;
|
208
208
|
case GRN_DB_INT32:
|
209
|
-
|
210
|
-
|
209
|
+
*rb_value = INT2NUM(GRN_INT32_VALUE(bulk));
|
210
|
+
break;
|
211
211
|
case GRN_DB_UINT32:
|
212
|
-
|
213
|
-
|
212
|
+
*rb_value = UINT2NUM(GRN_UINT32_VALUE(bulk));
|
213
|
+
break;
|
214
214
|
case GRN_DB_INT64:
|
215
|
-
|
216
|
-
|
215
|
+
*rb_value = LL2NUM(GRN_INT64_VALUE(bulk));
|
216
|
+
break;
|
217
217
|
case GRN_DB_UINT64:
|
218
|
-
|
219
|
-
|
218
|
+
*rb_value = ULL2NUM(GRN_UINT64_VALUE(bulk));
|
219
|
+
break;
|
220
220
|
case GRN_DB_FLOAT:
|
221
|
-
|
222
|
-
|
221
|
+
*rb_value = rb_float_new(GRN_FLOAT_VALUE(bulk));
|
222
|
+
break;
|
223
223
|
case GRN_DB_TIME:
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
224
|
+
{
|
225
|
+
int64_t time_value, sec, usec;
|
226
|
+
|
227
|
+
time_value = GRN_TIME_VALUE(bulk);
|
228
|
+
GRN_TIME_UNPACK(time_value, sec, usec);
|
229
|
+
*rb_value = rb_funcall(rb_cTime, rb_intern("at"), 2,
|
230
|
+
LL2NUM(sec), LL2NUM(usec));
|
231
|
+
}
|
232
|
+
break;
|
233
233
|
case GRN_DB_SHORT_TEXT:
|
234
234
|
case GRN_DB_TEXT:
|
235
235
|
case GRN_DB_LONG_TEXT:
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
236
|
+
*rb_value = rb_grn_context_rb_string_new(context,
|
237
|
+
GRN_TEXT_VALUE(bulk),
|
238
|
+
GRN_TEXT_LEN(bulk));
|
239
|
+
break;
|
240
240
|
case GRN_DB_TOKYO_GEO_POINT:
|
241
|
-
|
242
|
-
|
241
|
+
{
|
242
|
+
int latitude, longitude;
|
243
243
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
244
|
+
GRN_GEO_POINT_VALUE(bulk, latitude, longitude);
|
245
|
+
*rb_value = rb_grn_tokyo_geo_point_new(latitude, longitude);
|
246
|
+
}
|
247
|
+
break;
|
248
248
|
case GRN_DB_WGS84_GEO_POINT:
|
249
|
-
|
250
|
-
|
249
|
+
{
|
250
|
+
int latitude, longitude;
|
251
251
|
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
252
|
+
GRN_GEO_POINT_VALUE(bulk, latitude, longitude);
|
253
|
+
*rb_value = rb_grn_wgs84_geo_point_new(latitude, longitude);
|
254
|
+
}
|
255
|
+
break;
|
256
256
|
default:
|
257
|
-
|
258
|
-
|
257
|
+
success = GRN_FALSE;
|
258
|
+
break;
|
259
259
|
}
|
260
260
|
|
261
261
|
return success;
|
@@ -263,62 +263,62 @@ rb_grn_bulk_to_ruby_object_by_range_id (grn_ctx *context, grn_obj *bulk,
|
|
263
263
|
|
264
264
|
static VALUE
|
265
265
|
rb_grn_bulk_to_ruby_object_by_range_type (grn_ctx *context, grn_obj *bulk,
|
266
|
-
|
267
|
-
|
266
|
+
grn_obj *range, grn_id range_id,
|
267
|
+
VALUE related_object, VALUE *rb_value)
|
268
268
|
{
|
269
269
|
grn_bool success = GRN_TRUE;
|
270
270
|
|
271
271
|
if (!range && range_id != GRN_ID_NIL) {
|
272
|
-
|
272
|
+
range = grn_ctx_at(context, range_id);
|
273
273
|
}
|
274
274
|
|
275
275
|
if (!range)
|
276
|
-
|
276
|
+
return GRN_FALSE;
|
277
277
|
|
278
278
|
switch (range->header.type) {
|
279
279
|
case GRN_TABLE_HASH_KEY:
|
280
280
|
case GRN_TABLE_PAT_KEY:
|
281
281
|
case GRN_TABLE_DAT_KEY:
|
282
282
|
case GRN_TABLE_NO_KEY:
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
283
|
+
{
|
284
|
+
grn_id id;
|
285
|
+
|
286
|
+
id = *((grn_id *)GRN_BULK_HEAD(bulk));
|
287
|
+
if (id == GRN_ID_NIL) {
|
288
|
+
*rb_value = Qnil;
|
289
|
+
} else {
|
290
|
+
VALUE rb_range;
|
291
|
+
|
292
|
+
rb_range = GRNOBJECT2RVAL(Qnil, context, range, GRN_FALSE);
|
293
|
+
*rb_value = rb_grn_record_new(rb_range, id, Qnil);
|
294
|
+
}
|
295
|
+
}
|
296
|
+
break;
|
297
297
|
case GRN_TYPE:
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
298
|
+
if (range->header.flags & GRN_OBJ_KEY_VAR_SIZE) {
|
299
|
+
*rb_value = rb_grn_context_rb_string_new(context,
|
300
|
+
GRN_BULK_HEAD(bulk),
|
301
|
+
GRN_BULK_VSIZE(bulk));
|
302
|
+
} else {
|
303
|
+
switch (range->header.flags & GRN_OBJ_KEY_MASK) {
|
304
|
+
case GRN_OBJ_KEY_UINT:
|
305
|
+
*rb_value = INT2NUM(GRN_UINT32_VALUE(bulk));
|
306
|
+
break;
|
307
|
+
case GRN_OBJ_KEY_INT:
|
308
|
+
*rb_value = INT2NUM(GRN_INT32_VALUE(bulk));
|
309
|
+
break;
|
310
|
+
case GRN_OBJ_KEY_FLOAT:
|
311
|
+
*rb_value = rb_float_new(GRN_FLOAT_VALUE(bulk));
|
312
|
+
break;
|
313
|
+
default:
|
314
|
+
success = GRN_FALSE;
|
315
|
+
}
|
316
|
+
break;
|
317
|
+
}
|
318
|
+
break;
|
319
319
|
default:
|
320
|
-
|
321
|
-
|
320
|
+
success = GRN_FALSE;
|
321
|
+
break;
|
322
322
|
}
|
323
323
|
|
324
324
|
return success;
|
@@ -326,27 +326,27 @@ rb_grn_bulk_to_ruby_object_by_range_type (grn_ctx *context, grn_obj *bulk,
|
|
326
326
|
|
327
327
|
VALUE
|
328
328
|
rb_grn_bulk_to_ruby_object (grn_ctx *context, grn_obj *bulk,
|
329
|
-
|
329
|
+
grn_obj *range, VALUE related_object)
|
330
330
|
{
|
331
331
|
grn_id range_id;
|
332
332
|
VALUE rb_value = Qnil;
|
333
333
|
|
334
334
|
if (GRN_BULK_EMPTYP(bulk))
|
335
|
-
|
335
|
+
return Qnil;
|
336
336
|
|
337
337
|
range_id = bulk->header.domain;
|
338
338
|
if (rb_grn_bulk_to_ruby_object_by_range_id(context, bulk, range_id,
|
339
|
-
|
340
|
-
|
339
|
+
related_object, &rb_value))
|
340
|
+
return rb_value;
|
341
341
|
|
342
342
|
if (rb_grn_bulk_to_ruby_object_by_range_type(context, bulk,
|
343
|
-
|
344
|
-
|
345
|
-
|
343
|
+
range, range_id,
|
344
|
+
related_object, &rb_value))
|
345
|
+
return rb_value;
|
346
346
|
|
347
347
|
return rb_grn_context_rb_string_new(context,
|
348
|
-
|
349
|
-
|
348
|
+
GRN_BULK_HEAD(bulk),
|
349
|
+
GRN_BULK_VSIZE(bulk));
|
350
350
|
}
|
351
351
|
|
352
352
|
grn_obj *
|
@@ -354,88 +354,88 @@ rb_grn_bulk_from_ruby_object (VALUE object, grn_ctx *context, grn_obj *bulk)
|
|
354
354
|
{
|
355
355
|
if (bulk && bulk->header.domain == GRN_DB_TIME)
|
356
356
|
return RVAL2GRNBULK_WITH_TYPE(object, context, bulk,
|
357
|
-
|
358
|
-
|
357
|
+
bulk->header.domain,
|
358
|
+
grn_ctx_at(context, bulk->header.domain));
|
359
359
|
|
360
360
|
if (!bulk) {
|
361
|
-
|
362
|
-
|
361
|
+
bulk = grn_obj_open(context, GRN_BULK, 0, GRN_ID_NIL);
|
362
|
+
rb_grn_context_check(context, object);
|
363
363
|
}
|
364
364
|
|
365
365
|
switch (TYPE(object)) {
|
366
366
|
case T_NIL:
|
367
|
-
|
368
|
-
|
367
|
+
grn_obj_reinit(context, bulk, GRN_DB_VOID, 0);
|
368
|
+
break;
|
369
369
|
case T_SYMBOL:
|
370
|
-
|
370
|
+
object = rb_funcall(object, rb_intern("to_s"), 0);
|
371
371
|
case T_STRING:
|
372
|
-
|
373
|
-
|
374
|
-
|
372
|
+
grn_obj_reinit(context, bulk, GRN_DB_TEXT, 0);
|
373
|
+
rb_grn_context_text_set(context, bulk, object);
|
374
|
+
break;
|
375
375
|
case T_FIXNUM:
|
376
|
-
|
377
|
-
|
378
|
-
|
376
|
+
grn_obj_reinit(context, bulk, GRN_DB_INT32, 0);
|
377
|
+
GRN_INT32_SET(context, bulk, NUM2INT(object));
|
378
|
+
break;
|
379
379
|
case T_BIGNUM:
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
380
|
+
{
|
381
|
+
int64_t int64_value;
|
382
|
+
int64_value = NUM2LL(object);
|
383
|
+
if (int64_value <= INT32_MAX) {
|
384
|
+
grn_obj_reinit(context, bulk, GRN_DB_INT32, 0);
|
385
|
+
GRN_INT32_SET(context, bulk, int64_value);
|
386
|
+
} else {
|
387
|
+
grn_obj_reinit(context, bulk, GRN_DB_INT64, 0);
|
388
|
+
GRN_INT64_SET(context, bulk, int64_value);
|
389
|
+
}
|
390
|
+
}
|
391
|
+
break;
|
392
392
|
case T_FLOAT:
|
393
|
-
|
394
|
-
|
395
|
-
|
393
|
+
grn_obj_reinit(context, bulk, GRN_DB_FLOAT, 0);
|
394
|
+
GRN_FLOAT_SET(context, bulk, NUM2DBL(object));
|
395
|
+
break;
|
396
396
|
case T_TRUE:
|
397
|
-
|
398
|
-
|
399
|
-
|
397
|
+
grn_obj_reinit(context, bulk, GRN_DB_BOOL, 0);
|
398
|
+
GRN_BOOL_SET(context, bulk, GRN_TRUE);
|
399
|
+
break;
|
400
400
|
case T_FALSE:
|
401
|
-
|
402
|
-
|
403
|
-
|
401
|
+
grn_obj_reinit(context, bulk, GRN_DB_BOOL, 0);
|
402
|
+
GRN_BOOL_SET(context, bulk, GRN_FALSE);
|
403
|
+
break;
|
404
404
|
default:
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
405
|
+
if (RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cTime))) {
|
406
|
+
VALUE sec, usec;
|
407
|
+
int64_t time_value;
|
408
|
+
|
409
|
+
sec = rb_funcall(object, rb_intern("to_i"), 0);
|
410
|
+
usec = rb_funcall(object, rb_intern("usec"), 0);
|
411
|
+
time_value = GRN_TIME_PACK(NUM2LL(sec), NUM2LL(usec));
|
412
|
+
grn_obj_reinit(context, bulk, GRN_DB_TIME, 0);
|
413
|
+
GRN_TIME_SET(context, bulk, time_value);
|
414
|
+
} else if (RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnObject))) {
|
415
|
+
grn_obj *grn_object;
|
416
|
+
grn_id id_value;
|
417
|
+
|
418
|
+
grn_object = RVAL2GRNOBJECT(object, &context);
|
419
|
+
grn_obj_reinit(context, bulk, grn_object->header.domain, 0);
|
420
|
+
id_value = grn_obj_id(context, grn_object);
|
421
|
+
GRN_RECORD_SET(context, bulk, id_value);
|
422
|
+
} else if (RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnRecord))) {
|
423
|
+
grn_obj *table;
|
424
|
+
grn_id id_value;
|
425
|
+
|
426
|
+
table = RVAL2GRNOBJECT(rb_funcall(object, rb_intern("table"), 0),
|
427
|
+
&context);
|
428
|
+
id_value = NUM2UINT(rb_funcall(object, rb_intern("id"), 0));
|
429
|
+
grn_obj_reinit(context, bulk, grn_obj_id(context, table), 0);
|
430
|
+
GRN_RECORD_SET(context, bulk, id_value);
|
431
|
+
} else {
|
432
|
+
rb_raise(rb_eTypeError,
|
433
|
+
"bulked object should be one of "
|
434
|
+
"[nil, true, false, String, Symbol, Integer, Float, Time, "
|
435
|
+
"Groonga::Object, Groonga::Record]: %s",
|
436
|
+
rb_grn_inspect(object));
|
437
|
+
}
|
438
|
+
break;
|
439
439
|
}
|
440
440
|
|
441
441
|
return bulk;
|
@@ -443,8 +443,8 @@ rb_grn_bulk_from_ruby_object (VALUE object, grn_ctx *context, grn_obj *bulk)
|
|
443
443
|
|
444
444
|
grn_obj *
|
445
445
|
rb_grn_bulk_from_ruby_object_with_type (VALUE object, grn_ctx *context,
|
446
|
-
|
447
|
-
|
446
|
+
grn_obj *bulk,
|
447
|
+
grn_id type_id, grn_obj *type)
|
448
448
|
{
|
449
449
|
const char *string;
|
450
450
|
unsigned int size;
|
@@ -462,40 +462,46 @@ rb_grn_bulk_from_ruby_object_with_type (VALUE object, grn_ctx *context,
|
|
462
462
|
|
463
463
|
string_p = rb_type(object) == T_STRING;
|
464
464
|
table_type_p = (GRN_TABLE_HASH_KEY <= type->header.type &&
|
465
|
-
|
465
|
+
type->header.type <= GRN_TABLE_NO_KEY);
|
466
466
|
|
467
467
|
switch (type_id) {
|
468
468
|
case GRN_DB_INT32:
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
469
|
+
int32_value = NUM2INT(object);
|
470
|
+
string = (const char *)&int32_value;
|
471
|
+
size = sizeof(int32_value);
|
472
|
+
break;
|
473
473
|
case GRN_DB_UINT32:
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
474
|
+
uint32_value = NUM2UINT(object);
|
475
|
+
string = (const char *)&uint32_value;
|
476
|
+
size = sizeof(uint32_value);
|
477
|
+
break;
|
478
478
|
case GRN_DB_INT64:
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
479
|
+
int64_value = NUM2LL(object);
|
480
|
+
string = (const char *)&int64_value;
|
481
|
+
size = sizeof(int64_value);
|
482
|
+
break;
|
483
483
|
case GRN_DB_UINT64:
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
484
|
+
uint64_value = NUM2ULL(object);
|
485
|
+
string = (const char *)&uint64_value;
|
486
|
+
size = sizeof(uint64_value);
|
487
|
+
break;
|
488
488
|
case GRN_DB_FLOAT:
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
489
|
+
double_value = NUM2DBL(object);
|
490
|
+
string = (const char *)&double_value;
|
491
|
+
size = sizeof(double_value);
|
492
|
+
break;
|
493
493
|
case GRN_DB_TIME:
|
494
|
-
|
495
|
-
|
494
|
+
{
|
495
|
+
VALUE rb_sec, rb_usec;
|
496
496
|
int64_t sec;
|
497
497
|
int32_t usec;
|
498
498
|
|
499
|
+
if (string_p) {
|
500
|
+
ID id_parse;
|
501
|
+
CONST_ID(id_parse, "parse");
|
502
|
+
object = rb_funcall(rb_cTime, id_parse, 1, object);
|
503
|
+
}
|
504
|
+
|
499
505
|
switch (TYPE(object)) {
|
500
506
|
case T_FIXNUM:
|
501
507
|
case T_BIGNUM:
|
@@ -505,88 +511,88 @@ rb_grn_bulk_from_ruby_object_with_type (VALUE object, grn_ctx *context,
|
|
505
511
|
case T_FLOAT:
|
506
512
|
rb_sec = rb_funcall(object, rb_intern("to_i"), 0);
|
507
513
|
rb_usec = rb_funcall(object, rb_intern("remainder"), 1,
|
508
|
-
|
514
|
+
INT2NUM(1));
|
509
515
|
|
510
516
|
sec = NUM2LL(rb_sec);
|
511
517
|
usec = (int32_t)(NUM2DBL(rb_usec) * 1000000);
|
512
518
|
break;
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
519
|
+
case T_NIL:
|
520
|
+
sec = 0;
|
521
|
+
usec = 0;
|
522
|
+
break;
|
517
523
|
default:
|
518
524
|
sec = NUM2LL(rb_funcall(object, rb_intern("to_i"), 0));
|
519
525
|
usec = NUM2INT(rb_funcall(object, rb_intern("usec"), 0));
|
520
526
|
break;
|
521
527
|
}
|
522
528
|
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
529
|
+
time_value = GRN_TIME_PACK(sec, usec);
|
530
|
+
}
|
531
|
+
string = (const char *)&time_value;
|
532
|
+
size = sizeof(time_value);
|
533
|
+
break;
|
528
534
|
case GRN_DB_SHORT_TEXT:
|
529
535
|
case GRN_DB_TEXT:
|
530
536
|
case GRN_DB_LONG_TEXT:
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
537
|
+
string = StringValuePtr(object);
|
538
|
+
size = RSTRING_LEN(object);
|
539
|
+
range = grn_obj_get_range(context, type);
|
540
|
+
if (size > range)
|
541
|
+
rb_raise(rb_eArgError,
|
542
|
+
"string is too large: expected: %u <= %u",
|
543
|
+
size, range);
|
544
|
+
flags |= GRN_OBJ_DO_SHALLOW_COPY;
|
545
|
+
break;
|
540
546
|
case GRN_DB_TOKYO_GEO_POINT:
|
541
547
|
case GRN_DB_WGS84_GEO_POINT:
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
548
|
+
{
|
549
|
+
VALUE rb_geo_point;
|
550
|
+
VALUE rb_latitude, rb_longitude;
|
551
|
+
if (type_id == GRN_DB_TOKYO_GEO_POINT) {
|
552
|
+
rb_geo_point = rb_funcall(rb_cGrnTokyoGeoPoint,
|
553
|
+
rb_intern("new"), 1, object);
|
554
|
+
} else {
|
555
|
+
rb_geo_point = rb_funcall(rb_cGrnWGS84GeoPoint,
|
556
|
+
rb_intern("new"), 1, object);
|
557
|
+
}
|
558
|
+
rb_geo_point = rb_funcall(rb_geo_point, rb_intern("to_msec"), 0);
|
559
|
+
rb_latitude = rb_funcall(rb_geo_point, rb_intern("latitude"), 0);
|
560
|
+
rb_longitude = rb_funcall(rb_geo_point, rb_intern("longitude"), 0);
|
561
|
+
geo_point_value.latitude = NUM2INT(rb_latitude);
|
562
|
+
geo_point_value.longitude = NUM2INT(rb_longitude);
|
563
|
+
string = (const char *)&geo_point_value;
|
564
|
+
size = sizeof(geo_point_value);
|
565
|
+
}
|
566
|
+
break;
|
561
567
|
case GRN_DB_VOID:
|
562
568
|
case GRN_DB_DELIMIT:
|
563
569
|
case GRN_DB_UNIGRAM:
|
564
570
|
case GRN_DB_BIGRAM:
|
565
571
|
case GRN_DB_TRIGRAM:
|
566
572
|
case GRN_DB_MECAB:
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
573
|
+
rb_type_object = GRNOBJECT2RVAL(Qnil, context, type, GRN_FALSE);
|
574
|
+
rb_raise(rb_eArgError,
|
575
|
+
"unbulkable type: %s",
|
576
|
+
rb_grn_inspect(rb_type_object));
|
577
|
+
break;
|
572
578
|
default:
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
579
|
+
if (table_type_p &&
|
580
|
+
(NIL_P(object) || (string_p && RSTRING_LEN(object) == 0))) {
|
581
|
+
record_id = GRN_ID_NIL;
|
582
|
+
string = (const char *)&record_id;
|
583
|
+
size = sizeof(record_id);
|
584
|
+
if (bulk && bulk->header.domain != type_id) {
|
585
|
+
grn_obj_reinit(context, bulk, type_id, 0);
|
586
|
+
}
|
587
|
+
} else {
|
588
|
+
return RVAL2GRNBULK(object, context, bulk);
|
589
|
+
}
|
590
|
+
break;
|
585
591
|
}
|
586
592
|
|
587
593
|
if (!bulk) {
|
588
|
-
|
589
|
-
|
594
|
+
bulk = grn_obj_open(context, GRN_BULK, flags, GRN_ID_NIL);
|
595
|
+
rb_grn_context_check(context, object);
|
590
596
|
}
|
591
597
|
GRN_TEXT_SET(context, bulk, string, size);
|
592
598
|
|
@@ -602,22 +608,22 @@ rb_grn_vector_to_ruby_object (grn_ctx *context, grn_obj *vector)
|
|
602
608
|
unsigned int i, n;
|
603
609
|
|
604
610
|
if (!vector)
|
605
|
-
|
611
|
+
return Qnil;
|
606
612
|
|
607
613
|
GRN_VOID_INIT(&value);
|
608
614
|
n = grn_vector_size(context, vector);
|
609
615
|
array = rb_ary_new2(n);
|
610
616
|
for (i = 0; i < n; i++) {
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
617
|
+
const char *_value;
|
618
|
+
unsigned int weight, length;
|
619
|
+
grn_id domain;
|
620
|
+
|
621
|
+
length = grn_vector_get_element(context, vector, i,
|
622
|
+
&_value, &weight, &domain);
|
623
|
+
grn_obj_reinit(context, &value, domain, 0);
|
624
|
+
grn_bulk_write(context, &value, _value, length);
|
625
|
+
rb_ary_push(array, GRNOBJ2RVAL(Qnil, context, &value, Qnil));
|
626
|
+
/* UINT2NUM(weight); */ /* TODO: How handle weight? */
|
621
627
|
}
|
622
628
|
GRN_OBJ_FIN(context, &value);
|
623
629
|
|
@@ -697,12 +703,15 @@ rb_grn_vector_from_ruby_object (VALUE object, grn_ctx *context, grn_obj *vector)
|
|
697
703
|
VectorFromRubyData data;
|
698
704
|
|
699
705
|
if (NIL_P(object))
|
700
|
-
|
706
|
+
return vector;
|
701
707
|
|
702
708
|
data.array = rb_grn_convert_to_array(object);
|
703
709
|
data.context = context;
|
704
710
|
data.vector = vector;
|
705
|
-
|
711
|
+
GRN_OBJ_INIT(&(data.value_buffer),
|
712
|
+
GRN_BULK,
|
713
|
+
0,
|
714
|
+
vector->header.domain);
|
706
715
|
rb_ensure(rb_grn_vector_from_ruby_object_body, (VALUE)(&data),
|
707
716
|
rb_grn_vector_from_ruby_object_ensure, (VALUE)(&data));
|
708
717
|
|
@@ -710,64 +719,238 @@ rb_grn_vector_from_ruby_object (VALUE object, grn_ctx *context, grn_obj *vector)
|
|
710
719
|
}
|
711
720
|
|
712
721
|
VALUE
|
713
|
-
rb_grn_uvector_to_ruby_object (grn_ctx *context, grn_obj *uvector
|
722
|
+
rb_grn_uvector_to_ruby_object (grn_ctx *context, grn_obj *uvector,
|
723
|
+
grn_obj *range, VALUE related_object)
|
714
724
|
{
|
715
|
-
VALUE array;
|
716
|
-
grn_id *current, *end;
|
725
|
+
VALUE array = Qnil;
|
717
726
|
|
718
727
|
if (!uvector)
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
728
|
+
return Qnil;
|
729
|
+
|
730
|
+
if (!range) {
|
731
|
+
rb_raise(rb_eTypeError,
|
732
|
+
"unknown range uvector can't be converted: <%s>",
|
733
|
+
rb_grn_inspect(related_object));
|
734
|
+
}
|
735
|
+
|
736
|
+
switch (range->header.type) {
|
737
|
+
case GRN_TYPE:
|
738
|
+
{
|
739
|
+
const char *current, *end;
|
740
|
+
grn_id range_id;
|
741
|
+
grn_obj value;
|
742
|
+
int value_size;
|
743
|
+
value_size = grn_obj_get_range(context, range);
|
744
|
+
array = rb_ary_new();
|
745
|
+
current = GRN_BULK_HEAD(uvector);
|
746
|
+
end = GRN_BULK_CURR(uvector);
|
747
|
+
range_id = grn_obj_id(context, range);
|
748
|
+
GRN_OBJ_INIT(&value, GRN_BULK, GRN_OBJ_DO_SHALLOW_COPY, range_id);
|
749
|
+
while (current < end) {
|
750
|
+
VALUE rb_value;
|
751
|
+
GRN_TEXT_SET(context, &value, current, value_size);
|
752
|
+
rb_value = GRNBULK2RVAL(context, &value, range, related_object);
|
753
|
+
rb_ary_push(array, rb_value);
|
754
|
+
current += value_size;
|
755
|
+
}
|
756
|
+
GRN_OBJ_FIN(context, &value);
|
757
|
+
}
|
758
|
+
break;
|
759
|
+
case GRN_TABLE_HASH_KEY:
|
760
|
+
case GRN_TABLE_PAT_KEY:
|
761
|
+
case GRN_TABLE_DAT_KEY:
|
762
|
+
case GRN_TABLE_NO_KEY:
|
763
|
+
{
|
764
|
+
grn_id *current, *end;
|
765
|
+
VALUE rb_range = Qnil;
|
766
|
+
array = rb_ary_new();
|
767
|
+
rb_range = GRNTABLE2RVAL(context, range, GRN_FALSE);
|
768
|
+
current = (grn_id *)GRN_BULK_HEAD(uvector);
|
769
|
+
end = (grn_id *)GRN_BULK_CURR(uvector);
|
770
|
+
while (current < end) {
|
771
|
+
VALUE record = Qnil;
|
772
|
+
if (*current != GRN_ID_NIL) {
|
773
|
+
record = rb_grn_record_new(rb_range, *current, Qnil);
|
774
|
+
}
|
775
|
+
rb_ary_push(array, record);
|
776
|
+
current++;
|
777
|
+
}
|
778
|
+
}
|
779
|
+
break;
|
780
|
+
default:
|
781
|
+
rb_raise(rb_eTypeError,
|
782
|
+
"unknown range uvector can't be converted: %s(%#x): <%s>",
|
783
|
+
rb_grn_inspect_type(range->header.type),
|
784
|
+
range->header.type,
|
785
|
+
rb_grn_inspect(related_object));
|
786
|
+
break;
|
727
787
|
}
|
728
788
|
|
729
789
|
return array;
|
730
790
|
}
|
731
791
|
|
732
|
-
|
733
|
-
|
734
|
-
|
792
|
+
typedef struct {
|
793
|
+
VALUE object;
|
794
|
+
grn_ctx *context;
|
795
|
+
grn_obj *uvector;
|
796
|
+
VALUE related_object;
|
797
|
+
|
798
|
+
grn_obj element_buffer;
|
799
|
+
grn_obj *domain;
|
800
|
+
grn_bool succeeded;
|
801
|
+
} UVectorFromRubyData;
|
802
|
+
|
803
|
+
static void
|
804
|
+
rb_grn_uvector_from_ruby_object_type (UVectorFromRubyData *data)
|
735
805
|
{
|
736
|
-
VALUE
|
806
|
+
VALUE object;
|
807
|
+
grn_ctx *context;
|
808
|
+
grn_obj *uvector;
|
809
|
+
grn_obj *type;
|
810
|
+
VALUE *rb_values;
|
737
811
|
int i, n;
|
812
|
+
grn_obj *grn_value;
|
813
|
+
int value_size;
|
738
814
|
|
739
|
-
|
740
|
-
|
815
|
+
object = data->object;
|
816
|
+
context = data->context;
|
817
|
+
uvector = data->uvector;
|
818
|
+
type = data->domain;
|
819
|
+
grn_value = &(data->element_buffer);
|
820
|
+
|
821
|
+
n = RARRAY_LEN(object);
|
822
|
+
rb_values = RARRAY_PTR(object);
|
823
|
+
value_size = grn_obj_get_range(context, type);
|
824
|
+
for (i = 0; i < n; i++) {
|
825
|
+
GRN_BULK_REWIND(grn_value);
|
826
|
+
RVAL2GRNBULK(rb_values[i], context, grn_value);
|
827
|
+
grn_bulk_write(context, uvector, GRN_BULK_HEAD(grn_value), value_size);
|
828
|
+
}
|
829
|
+
|
830
|
+
data->succeeded = GRN_TRUE;
|
831
|
+
}
|
832
|
+
|
833
|
+
static void
|
834
|
+
rb_grn_uvector_from_ruby_object_reference (UVectorFromRubyData *data)
|
835
|
+
{
|
836
|
+
VALUE object;
|
837
|
+
grn_ctx *context;
|
838
|
+
grn_obj *uvector;
|
839
|
+
VALUE related_object;
|
840
|
+
VALUE *rb_values;
|
841
|
+
int i, n;
|
842
|
+
|
843
|
+
object = data->object;
|
844
|
+
context = data->context;
|
845
|
+
uvector = data->uvector;
|
846
|
+
related_object = data->related_object;
|
741
847
|
|
742
848
|
n = RARRAY_LEN(object);
|
743
|
-
|
849
|
+
rb_values = RARRAY_PTR(object);
|
744
850
|
for (i = 0; i < n; i++) {
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
851
|
+
VALUE rb_value;
|
852
|
+
grn_id id;
|
853
|
+
void *grn_value;
|
854
|
+
ID id_record_raw_id;
|
855
|
+
|
856
|
+
rb_value = rb_values[i];
|
857
|
+
switch (TYPE(rb_value)) {
|
858
|
+
case T_FIXNUM:
|
859
|
+
id = NUM2UINT(rb_value);
|
860
|
+
break;
|
861
|
+
default:
|
862
|
+
CONST_ID(id_record_raw_id, "record_raw_id");
|
863
|
+
if (rb_respond_to(rb_value, id_record_raw_id)) {
|
864
|
+
id = NUM2UINT(rb_funcall(rb_value, id_record_raw_id, 0));
|
865
|
+
} else {
|
866
|
+
rb_raise(rb_eArgError,
|
867
|
+
"uvector value should be one of "
|
868
|
+
"[Fixnum or object that has #record_raw_id]: "
|
869
|
+
"%s (%s): %s",
|
870
|
+
rb_grn_inspect(rb_value),
|
871
|
+
rb_grn_inspect(object),
|
872
|
+
rb_grn_inspect(related_object));
|
873
|
+
}
|
874
|
+
break;
|
875
|
+
}
|
876
|
+
grn_value = &id;
|
877
|
+
grn_bulk_write(context, uvector, grn_value, sizeof(grn_id));
|
878
|
+
}
|
879
|
+
|
880
|
+
data->succeeded = GRN_TRUE;
|
881
|
+
}
|
882
|
+
|
883
|
+
static VALUE
|
884
|
+
rb_grn_uvector_from_ruby_object_body (VALUE user_data)
|
885
|
+
{
|
886
|
+
UVectorFromRubyData *data = (UVectorFromRubyData *)user_data;
|
887
|
+
grn_obj *domain;
|
888
|
+
|
889
|
+
domain = data->domain;
|
890
|
+
switch (domain->header.type) {
|
891
|
+
case GRN_TYPE:
|
892
|
+
rb_grn_uvector_from_ruby_object_type(data);
|
893
|
+
break;
|
894
|
+
case GRN_TABLE_HASH_KEY:
|
895
|
+
case GRN_TABLE_PAT_KEY:
|
896
|
+
case GRN_TABLE_DAT_KEY:
|
897
|
+
case GRN_TABLE_NO_KEY:
|
898
|
+
rb_grn_uvector_from_ruby_object_reference(data);
|
899
|
+
break;
|
900
|
+
default:
|
901
|
+
rb_raise(rb_eTypeError,
|
902
|
+
"can't convert to unknown domain uvector: %s(%#x): <%s>",
|
903
|
+
rb_grn_inspect_type(domain->header.type),
|
904
|
+
domain->header.type,
|
905
|
+
rb_grn_inspect(data->related_object));
|
906
|
+
break;
|
907
|
+
}
|
908
|
+
|
909
|
+
return Qnil;
|
910
|
+
}
|
911
|
+
|
912
|
+
static VALUE
|
913
|
+
rb_grn_uvector_from_ruby_object_ensure (VALUE user_data)
|
914
|
+
{
|
915
|
+
UVectorFromRubyData *data = (UVectorFromRubyData *)user_data;
|
916
|
+
|
917
|
+
if (data->domain) {
|
918
|
+
grn_obj_unlink(data->context, data->domain);
|
919
|
+
}
|
920
|
+
GRN_OBJ_FIN(data->context, &(data->element_buffer));
|
921
|
+
|
922
|
+
return Qnil;
|
923
|
+
}
|
924
|
+
|
925
|
+
grn_obj *
|
926
|
+
rb_grn_uvector_from_ruby_object (VALUE object, grn_ctx *context,
|
927
|
+
grn_obj *uvector, VALUE related_object)
|
928
|
+
{
|
929
|
+
UVectorFromRubyData data;
|
930
|
+
|
931
|
+
if (NIL_P(object))
|
932
|
+
return NULL;
|
933
|
+
|
934
|
+
data.domain = grn_ctx_at(context, uvector->header.domain);
|
935
|
+
if (!data.domain) {
|
936
|
+
rb_raise(rb_eArgError,
|
937
|
+
"unknown domain uvector can't be converted: <%s>",
|
938
|
+
rb_grn_inspect(related_object));
|
939
|
+
}
|
940
|
+
|
941
|
+
GRN_OBJ_INIT(&(data.element_buffer), GRN_BULK, 0, uvector->header.domain);
|
942
|
+
|
943
|
+
data.object = object;
|
944
|
+
data.context = context;
|
945
|
+
data.uvector = uvector;
|
946
|
+
data.related_object = related_object;
|
947
|
+
data.succeeded = GRN_FALSE;
|
948
|
+
|
949
|
+
rb_ensure(rb_grn_uvector_from_ruby_object_body, (VALUE)(&data),
|
950
|
+
rb_grn_uvector_from_ruby_object_ensure, (VALUE)(&data));
|
951
|
+
|
952
|
+
if (!data.succeeded) {
|
953
|
+
return NULL;
|
771
954
|
}
|
772
955
|
|
773
956
|
return uvector;
|
@@ -775,100 +958,84 @@ rb_grn_uvector_from_ruby_object (VALUE object, grn_ctx *context,
|
|
775
958
|
|
776
959
|
VALUE
|
777
960
|
rb_grn_value_to_ruby_object (grn_ctx *context,
|
778
|
-
|
779
|
-
|
780
|
-
|
961
|
+
grn_obj *value,
|
962
|
+
grn_obj *range,
|
963
|
+
VALUE related_object)
|
781
964
|
{
|
782
965
|
if (!value)
|
783
|
-
|
966
|
+
return Qnil;
|
784
967
|
|
785
968
|
switch (value->header.type) {
|
786
969
|
case GRN_VOID:
|
787
|
-
|
788
|
-
|
970
|
+
return Qnil;
|
971
|
+
break;
|
789
972
|
case GRN_BULK:
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
973
|
+
if (GRN_BULK_EMPTYP(value))
|
974
|
+
return Qnil;
|
975
|
+
if (value->header.domain == GRN_ID_NIL && range)
|
976
|
+
value->header.domain = grn_obj_id(context, range);
|
977
|
+
return GRNBULK2RVAL(context, value, range, related_object);
|
978
|
+
break;
|
796
979
|
case GRN_UVECTOR:
|
797
|
-
|
798
|
-
|
799
|
-
grn_id *uvector, *uvector_end;
|
800
|
-
|
801
|
-
rb_value = rb_ary_new();
|
802
|
-
if (range)
|
803
|
-
rb_range = GRNTABLE2RVAL(context, range, GRN_FALSE);
|
804
|
-
uvector = (grn_id *)GRN_BULK_HEAD(value);
|
805
|
-
uvector_end = (grn_id *)GRN_BULK_CURR(value);
|
806
|
-
for (; uvector < uvector_end; uvector++) {
|
807
|
-
VALUE record = Qnil;
|
808
|
-
if (*uvector != GRN_ID_NIL)
|
809
|
-
record = rb_grn_record_new(rb_range, *uvector, Qnil);
|
810
|
-
rb_ary_push(rb_value, record);
|
811
|
-
}
|
812
|
-
return rb_value;
|
813
|
-
}
|
814
|
-
break;
|
980
|
+
return GRNUVECTOR2RVAL(context, value, range, related_object);
|
981
|
+
break;
|
815
982
|
case GRN_VECTOR:
|
816
|
-
|
817
|
-
|
983
|
+
return GRNVECTOR2RVAL(context, value);
|
984
|
+
break;
|
818
985
|
default:
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
986
|
+
rb_raise(rb_eGrnError,
|
987
|
+
"unsupported value type: %s(%#x): %s",
|
988
|
+
rb_grn_inspect_type(value->header.type),
|
989
|
+
value->header.type,
|
990
|
+
rb_grn_inspect(related_object));
|
991
|
+
break;
|
825
992
|
}
|
826
993
|
|
827
994
|
if (!range)
|
828
|
-
|
995
|
+
return GRNOBJECT2RVAL(Qnil, context, value, GRN_FALSE);
|
829
996
|
|
830
997
|
return Qnil;
|
831
998
|
}
|
832
999
|
|
833
1000
|
grn_id
|
834
1001
|
rb_grn_id_from_ruby_object (VALUE object, grn_ctx *context, grn_obj *table,
|
835
|
-
|
1002
|
+
VALUE related_object)
|
836
1003
|
{
|
837
1004
|
VALUE rb_id;
|
838
1005
|
|
839
1006
|
if (NIL_P(object))
|
840
|
-
|
1007
|
+
return Qnil;
|
841
1008
|
|
842
1009
|
if (RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnRecord))) {
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
1010
|
+
VALUE rb_table;
|
1011
|
+
rb_table = rb_funcall(object, rb_intern("table"), 0);
|
1012
|
+
if (table && RVAL2GRNOBJECT(rb_table, &context) != table) {
|
1013
|
+
VALUE rb_expected_table;
|
1014
|
+
|
1015
|
+
rb_expected_table =
|
1016
|
+
GRNOBJECT2RVAL(Qnil, context, table, GRN_FALSE);
|
1017
|
+
rb_raise(rb_eGrnError,
|
1018
|
+
"wrong table: expected <%s>: actual <%s>",
|
1019
|
+
rb_grn_inspect(rb_expected_table),
|
1020
|
+
rb_grn_inspect(rb_table));
|
1021
|
+
}
|
1022
|
+
rb_id = rb_funcall(object, rb_intern("id"), 0);
|
856
1023
|
} else {
|
857
|
-
|
1024
|
+
rb_id = object;
|
858
1025
|
}
|
859
1026
|
|
860
1027
|
if (!RVAL2CBOOL(rb_obj_is_kind_of(rb_id, rb_cInteger)))
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
1028
|
+
rb_raise(rb_eGrnError,
|
1029
|
+
"should be unsigned integer or Groogna::Record: <%s>: <%s>",
|
1030
|
+
rb_grn_inspect(object),
|
1031
|
+
rb_grn_inspect(related_object));
|
865
1032
|
|
866
1033
|
return NUM2UINT(rb_id);
|
867
1034
|
}
|
868
1035
|
|
869
1036
|
VALUE
|
870
1037
|
rb_grn_key_to_ruby_object (grn_ctx *context, const void *key, int key_size,
|
871
|
-
|
1038
|
+
grn_obj *table, VALUE related_object)
|
872
1039
|
{
|
873
1040
|
grn_obj bulk;
|
874
1041
|
|
@@ -880,33 +1047,33 @@ rb_grn_key_to_ruby_object (grn_ctx *context, const void *key, int key_size,
|
|
880
1047
|
|
881
1048
|
grn_obj *
|
882
1049
|
rb_grn_key_from_ruby_object (VALUE rb_key, grn_ctx *context,
|
883
|
-
|
884
|
-
|
1050
|
+
grn_obj *key, grn_id domain_id, grn_obj *domain,
|
1051
|
+
VALUE related_object)
|
885
1052
|
{
|
886
1053
|
grn_id id;
|
887
1054
|
|
888
1055
|
if (!domain)
|
889
|
-
|
1056
|
+
return RVAL2GRNBULK(rb_key, context, key);
|
890
1057
|
|
891
1058
|
switch (domain->header.type) {
|
892
1059
|
case GRN_TYPE:
|
893
|
-
|
894
|
-
|
1060
|
+
return RVAL2GRNBULK_WITH_TYPE(rb_key, context, key, domain_id, domain);
|
1061
|
+
break;
|
895
1062
|
case GRN_TABLE_HASH_KEY:
|
896
1063
|
case GRN_TABLE_PAT_KEY:
|
897
1064
|
case GRN_TABLE_DAT_KEY:
|
898
1065
|
case GRN_TABLE_NO_KEY:
|
899
|
-
|
900
|
-
|
1066
|
+
id = RVAL2GRNID(rb_key, context, domain, related_object);
|
1067
|
+
break;
|
901
1068
|
default:
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
1069
|
+
if (!RVAL2CBOOL(rb_obj_is_kind_of(rb_key, rb_cInteger)))
|
1070
|
+
rb_raise(rb_eGrnError,
|
1071
|
+
"should be unsigned integer: <%s>: <%s>",
|
1072
|
+
rb_grn_inspect(rb_key),
|
1073
|
+
rb_grn_inspect(related_object));
|
1074
|
+
|
1075
|
+
id = NUM2UINT(rb_key);
|
1076
|
+
break;
|
910
1077
|
}
|
911
1078
|
|
912
1079
|
GRN_TEXT_SET(context, key, &id, sizeof(id));
|
@@ -915,28 +1082,28 @@ rb_grn_key_from_ruby_object (VALUE rb_key, grn_ctx *context,
|
|
915
1082
|
|
916
1083
|
grn_obj *
|
917
1084
|
rb_grn_value_from_ruby_object (VALUE object, grn_ctx *context,
|
918
|
-
|
1085
|
+
grn_obj *value, grn_id type_id, grn_obj *type)
|
919
1086
|
{
|
920
1087
|
grn_bool string_p, table_type_p;
|
921
1088
|
|
922
1089
|
string_p = rb_type(object) == T_STRING;
|
923
1090
|
table_type_p = (GRN_TABLE_HASH_KEY <= type->header.type &&
|
924
|
-
|
1091
|
+
type->header.type <= GRN_TABLE_NO_KEY);
|
925
1092
|
if (!string_p) {
|
926
|
-
|
1093
|
+
return RVAL2GRNBULK_WITH_TYPE(object, context, value, type_id, type);
|
927
1094
|
}
|
928
1095
|
|
929
1096
|
if (table_type_p && RSTRING_LEN(object) == 0) {
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
1097
|
+
if (value) {
|
1098
|
+
if (value->header.domain != type_id) {
|
1099
|
+
grn_obj_reinit(context, value, type_id, 0);
|
1100
|
+
}
|
1101
|
+
} else {
|
1102
|
+
value = grn_obj_open(context, GRN_BULK, 0, type_id);
|
1103
|
+
rb_grn_context_check(context, object);
|
1104
|
+
}
|
1105
|
+
GRN_RECORD_SET(context, value, GRN_ID_NIL);
|
1106
|
+
return value;
|
940
1107
|
}
|
941
1108
|
|
942
1109
|
return RVAL2GRNBULK(object, context, value);
|
@@ -946,12 +1113,12 @@ grn_obj *
|
|
946
1113
|
rb_grn_obj_from_ruby_object (VALUE rb_object, grn_ctx *context, grn_obj **_obj)
|
947
1114
|
{
|
948
1115
|
if (RVAL2CBOOL(rb_obj_is_kind_of(rb_object, rb_cGrnObject))) {
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
1116
|
+
if (*_obj) {
|
1117
|
+
grn_obj_unlink(context, *_obj); /* TODO: reduce memory allocation */
|
1118
|
+
}
|
1119
|
+
*_obj = RVAL2GRNOBJECT(rb_object, &context);
|
953
1120
|
} else {
|
954
|
-
|
1121
|
+
*_obj = RVAL2GRNBULK(rb_object, context, *_obj);
|
955
1122
|
}
|
956
1123
|
|
957
1124
|
return *_obj;
|
@@ -959,24 +1126,24 @@ rb_grn_obj_from_ruby_object (VALUE rb_object, grn_ctx *context, grn_obj **_obj)
|
|
959
1126
|
|
960
1127
|
VALUE
|
961
1128
|
rb_grn_obj_to_ruby_object (VALUE klass, grn_ctx *context,
|
962
|
-
|
1129
|
+
grn_obj *obj, VALUE related_object)
|
963
1130
|
{
|
964
1131
|
if (!obj)
|
965
|
-
|
1132
|
+
return Qnil;
|
966
1133
|
|
967
1134
|
/* if (NIL_P(klass)) */
|
968
|
-
/*
|
1135
|
+
/* klass = GRNOBJECT2RCLASS(obj); */
|
969
1136
|
|
970
1137
|
switch (obj->header.type) {
|
971
1138
|
case GRN_VOID:
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
1139
|
+
if (GRN_BULK_VSIZE(obj) > 0)
|
1140
|
+
return rb_str_new(GRN_BULK_HEAD(obj), GRN_BULK_VSIZE(obj));
|
1141
|
+
else
|
1142
|
+
return Qnil;
|
1143
|
+
break;
|
977
1144
|
case GRN_BULK:
|
978
|
-
|
979
|
-
|
1145
|
+
return GRNBULK2RVAL(context, obj, NULL, related_object);
|
1146
|
+
break;
|
980
1147
|
/* case GRN_PTR: */
|
981
1148
|
/* case GRN_UVECTOR: */
|
982
1149
|
/* case GRN_PVECTOR: */
|
@@ -1002,12 +1169,12 @@ rb_grn_obj_to_ruby_object (VALUE klass, grn_ctx *context,
|
|
1002
1169
|
/* case GRN_COLUMN_VAR_SIZE: */
|
1003
1170
|
/* case GRN_COLUMN_INDEX: */
|
1004
1171
|
default:
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1172
|
+
rb_raise(rb_eTypeError,
|
1173
|
+
"unsupported groonga object: %s(%#x): <%s>",
|
1174
|
+
rb_grn_inspect_type(obj->header.type),
|
1175
|
+
obj->header.type,
|
1176
|
+
rb_grn_inspect(related_object));
|
1177
|
+
break;
|
1011
1178
|
}
|
1012
1179
|
|
1013
1180
|
return Qnil;
|