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.
Files changed (374) hide show
  1. data/doc/text/news.textile +21 -0
  2. data/ext/groonga/rb-grn-index-column.c +353 -1
  3. data/ext/groonga/rb-grn-object.c +529 -495
  4. data/ext/groonga/rb-grn-table.c +48 -0
  5. data/ext/groonga/rb-grn-utils.c +585 -418
  6. data/ext/groonga/rb-grn.h +6 -4
  7. data/lib/1.9/groonga.so +0 -0
  8. data/lib/2.0/groonga.so +0 -0
  9. data/lib/groonga/dumper.rb +25 -8
  10. data/lib/groonga/record.rb +21 -2
  11. data/lib/groonga/schema.rb +2 -2
  12. data/rroonga-build.rb +1 -1
  13. data/rroonga.gemspec +2 -0
  14. data/test/test-database-dumper.rb +45 -3
  15. data/test/test-expression-builder.rb +0 -13
  16. data/test/test-fix-size-column.rb +40 -9
  17. data/test/test-index-column.rb +130 -1
  18. data/test/test-record.rb +43 -8
  19. data/test/test-schema-create-table.rb +2 -2
  20. data/test/test-schema-dumper.rb +46 -6
  21. data/test/test-table.rb +4 -3
  22. data/test/test-variable-size-column.rb +115 -26
  23. data/vendor/local/bin/groonga-benchmark.exe +0 -0
  24. data/vendor/local/bin/groonga.exe +0 -0
  25. data/vendor/local/bin/libgcc_s_sjlj-1.dll +0 -0
  26. data/vendor/local/bin/libgroonga-0.dll +0 -0
  27. data/vendor/local/bin/libmecab-1.dll +0 -0
  28. data/vendor/local/bin/libmsgpack-3.dll +0 -0
  29. data/vendor/local/bin/libmsgpackc-2.dll +0 -0
  30. data/vendor/local/bin/libstdc++-6.dll +0 -0
  31. data/vendor/local/bin/mecab.exe +0 -0
  32. data/vendor/local/include/groonga/groonga.h +1 -9
  33. data/vendor/local/lib/groonga/plugins/query_expanders/tsv.a +0 -0
  34. data/vendor/local/lib/groonga/plugins/query_expanders/tsv.dll +0 -0
  35. data/vendor/local/lib/groonga/plugins/query_expanders/tsv.dll.a +0 -0
  36. data/vendor/local/lib/groonga/plugins/query_expanders/tsv.la +1 -1
  37. data/vendor/local/lib/groonga/plugins/suggest/suggest.a +0 -0
  38. data/vendor/local/lib/groonga/plugins/suggest/suggest.dll +0 -0
  39. data/vendor/local/lib/groonga/plugins/suggest/suggest.dll.a +0 -0
  40. data/vendor/local/lib/groonga/plugins/suggest/suggest.la +1 -1
  41. data/vendor/local/lib/groonga/plugins/table/table.a +0 -0
  42. data/vendor/local/lib/groonga/plugins/table/table.dll +0 -0
  43. data/vendor/local/lib/groonga/plugins/table/table.dll.a +0 -0
  44. data/vendor/local/lib/groonga/plugins/table/table.la +1 -1
  45. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.a +0 -0
  46. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.dll +0 -0
  47. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.dll.a +0 -0
  48. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.la +1 -1
  49. data/vendor/local/lib/libgroonga.a +0 -0
  50. data/vendor/local/lib/libgroonga.dll.a +0 -0
  51. data/vendor/local/lib/libgroonga.la +1 -1
  52. data/vendor/local/lib/libmecab.a +0 -0
  53. data/vendor/local/lib/libmecab.dll.a +0 -0
  54. data/vendor/local/lib/libmsgpack.a +0 -0
  55. data/vendor/local/lib/libmsgpack.dll.a +0 -0
  56. data/vendor/local/lib/libmsgpack.la +1 -1
  57. data/vendor/local/lib/libmsgpackc.a +0 -0
  58. data/vendor/local/lib/libmsgpackc.dll.a +0 -0
  59. data/vendor/local/lib/libmsgpackc.la +1 -1
  60. data/vendor/local/lib/pkgconfig/groonga.pc +2 -2
  61. data/vendor/local/libexec/mecab/mecab-cost-train.exe +0 -0
  62. data/vendor/local/libexec/mecab/mecab-dict-gen.exe +0 -0
  63. data/vendor/local/libexec/mecab/mecab-dict-index.exe +0 -0
  64. data/vendor/local/libexec/mecab/mecab-system-eval.exe +0 -0
  65. data/vendor/local/libexec/mecab/mecab-test-gen.exe +0 -0
  66. data/vendor/local/share/doc/groonga/en/html/.buildinfo +1 -1
  67. data/vendor/local/share/doc/groonga/en/html/_sources/install/centos.txt +3 -3
  68. data/vendor/local/share/doc/groonga/en/html/_sources/install/debian.txt +43 -3
  69. data/vendor/local/share/doc/groonga/en/html/_sources/install/fedora.txt +3 -3
  70. data/vendor/local/share/doc/groonga/en/html/_sources/install/mac_os_x.txt +3 -3
  71. data/vendor/local/share/doc/groonga/en/html/_sources/install/others.txt +3 -3
  72. data/vendor/local/share/doc/groonga/en/html/_sources/install/solaris.txt +3 -3
  73. data/vendor/local/share/doc/groonga/en/html/_sources/install/ubuntu.txt +3 -50
  74. data/vendor/local/share/doc/groonga/en/html/_sources/install/windows.txt +11 -21
  75. data/vendor/local/share/doc/groonga/en/html/_sources/news.txt +51 -0
  76. data/vendor/local/share/doc/groonga/en/html/_sources/reference/api/grn_ctx.txt +49 -0
  77. data/vendor/local/share/doc/groonga/en/html/_sources/reference/api.txt +8 -1
  78. data/vendor/local/share/doc/groonga/en/html/_sources/reference/commands/tokenize.txt +196 -0
  79. data/vendor/local/share/doc/groonga/en/html/_sources/reference/normalizers.txt +1 -1
  80. data/vendor/local/share/doc/groonga/en/html/_sources/reference/tokenizers.txt +16 -0
  81. data/vendor/local/share/doc/groonga/en/html/_static/pygments.css +2 -2
  82. data/vendor/local/share/doc/groonga/en/html/characteristic.html +5 -5
  83. data/vendor/local/share/doc/groonga/en/html/community.html +5 -5
  84. data/vendor/local/share/doc/groonga/en/html/contribution/development/com.html +5 -5
  85. data/vendor/local/share/doc/groonga/en/html/contribution/development/document.html +5 -5
  86. data/vendor/local/share/doc/groonga/en/html/contribution/development/query.html +5 -5
  87. data/vendor/local/share/doc/groonga/en/html/contribution/development/release.html +5 -5
  88. data/vendor/local/share/doc/groonga/en/html/contribution/development/repository.html +5 -5
  89. data/vendor/local/share/doc/groonga/en/html/contribution/development/test.html +5 -5
  90. data/vendor/local/share/doc/groonga/en/html/contribution/development.html +5 -5
  91. data/vendor/local/share/doc/groonga/en/html/contribution/documentation/c-api.html +5 -5
  92. data/vendor/local/share/doc/groonga/en/html/contribution/documentation/i18n.html +13 -5
  93. data/vendor/local/share/doc/groonga/en/html/contribution/documentation.html +5 -5
  94. data/vendor/local/share/doc/groonga/en/html/contribution/report.html +5 -5
  95. data/vendor/local/share/doc/groonga/en/html/contribution.html +5 -5
  96. data/vendor/local/share/doc/groonga/en/html/development/travis-ci.html +5 -5
  97. data/vendor/local/share/doc/groonga/en/html/development.html +5 -5
  98. data/vendor/local/share/doc/groonga/en/html/genindex.html +22 -5
  99. data/vendor/local/share/doc/groonga/en/html/geolocation_search.html +5 -5
  100. data/vendor/local/share/doc/groonga/en/html/index.html +19 -14
  101. data/vendor/local/share/doc/groonga/en/html/install/centos.html +8 -8
  102. data/vendor/local/share/doc/groonga/en/html/install/debian.html +48 -12
  103. data/vendor/local/share/doc/groonga/en/html/install/fedora.html +8 -8
  104. data/vendor/local/share/doc/groonga/en/html/install/mac_os_x.html +8 -8
  105. data/vendor/local/share/doc/groonga/en/html/install/others.html +8 -8
  106. data/vendor/local/share/doc/groonga/en/html/install/solaris.html +8 -8
  107. data/vendor/local/share/doc/groonga/en/html/install/ubuntu.html +16 -60
  108. data/vendor/local/share/doc/groonga/en/html/install/windows.html +16 -25
  109. data/vendor/local/share/doc/groonga/en/html/install.html +12 -12
  110. data/vendor/local/share/doc/groonga/en/html/limitations.html +5 -5
  111. data/vendor/local/share/doc/groonga/en/html/news/0.x.html +5 -5
  112. data/vendor/local/share/doc/groonga/en/html/news/1.0.x.html +5 -5
  113. data/vendor/local/share/doc/groonga/en/html/news/1.1.x.html +5 -5
  114. data/vendor/local/share/doc/groonga/en/html/news/1.2.x.html +5 -5
  115. data/vendor/local/share/doc/groonga/en/html/news/senna.html +5 -5
  116. data/vendor/local/share/doc/groonga/en/html/news.html +187 -129
  117. data/vendor/local/share/doc/groonga/en/html/objects.inv +0 -0
  118. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_ctx.html +198 -0
  119. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_expr.html +31 -6
  120. data/vendor/local/share/doc/groonga/en/html/reference/api.html +18 -11
  121. data/vendor/local/share/doc/groonga/en/html/reference/cast.html +5 -5
  122. data/vendor/local/share/doc/groonga/en/html/reference/command/command_version.html +5 -5
  123. data/vendor/local/share/doc/groonga/en/html/reference/command/output_format.html +5 -5
  124. data/vendor/local/share/doc/groonga/en/html/reference/command/return_code.html +5 -5
  125. data/vendor/local/share/doc/groonga/en/html/reference/command.html +7 -6
  126. data/vendor/local/share/doc/groonga/en/html/reference/commands/cache_limit.html +5 -5
  127. data/vendor/local/share/doc/groonga/en/html/reference/commands/check.html +5 -5
  128. data/vendor/local/share/doc/groonga/en/html/reference/commands/clearlock.html +5 -5
  129. data/vendor/local/share/doc/groonga/en/html/reference/commands/column_create.html +5 -5
  130. data/vendor/local/share/doc/groonga/en/html/reference/commands/column_list.html +5 -5
  131. data/vendor/local/share/doc/groonga/en/html/reference/commands/column_remove.html +17 -17
  132. data/vendor/local/share/doc/groonga/en/html/reference/commands/column_rename.html +5 -5
  133. data/vendor/local/share/doc/groonga/en/html/reference/commands/define_selector.html +5 -5
  134. data/vendor/local/share/doc/groonga/en/html/reference/commands/defrag.html +5 -5
  135. data/vendor/local/share/doc/groonga/en/html/reference/commands/delete.html +5 -5
  136. data/vendor/local/share/doc/groonga/en/html/reference/commands/dump.html +5 -5
  137. data/vendor/local/share/doc/groonga/en/html/reference/commands/load.html +5 -5
  138. data/vendor/local/share/doc/groonga/en/html/reference/commands/log_level.html +5 -5
  139. data/vendor/local/share/doc/groonga/en/html/reference/commands/log_put.html +5 -5
  140. data/vendor/local/share/doc/groonga/en/html/reference/commands/log_reopen.html +5 -5
  141. data/vendor/local/share/doc/groonga/en/html/reference/commands/normalize.html +5 -5
  142. data/vendor/local/share/doc/groonga/en/html/reference/commands/quit.html +5 -5
  143. data/vendor/local/share/doc/groonga/en/html/reference/commands/register.html +5 -5
  144. data/vendor/local/share/doc/groonga/en/html/reference/commands/select.html +5 -5
  145. data/vendor/local/share/doc/groonga/en/html/reference/commands/shutdown.html +5 -5
  146. data/vendor/local/share/doc/groonga/en/html/reference/commands/status.html +5 -5
  147. data/vendor/local/share/doc/groonga/en/html/reference/commands/suggest.html +5 -5
  148. data/vendor/local/share/doc/groonga/en/html/reference/commands/table_create.html +5 -5
  149. data/vendor/local/share/doc/groonga/en/html/reference/commands/table_list.html +5 -5
  150. data/vendor/local/share/doc/groonga/en/html/reference/commands/table_remove.html +10 -10
  151. data/vendor/local/share/doc/groonga/en/html/reference/commands/tokenize.html +310 -0
  152. data/vendor/local/share/doc/groonga/en/html/reference/commands/truncate.html +26 -26
  153. data/vendor/local/share/doc/groonga/en/html/reference/commands_not_implemented/add.html +5 -5
  154. data/vendor/local/share/doc/groonga/en/html/reference/commands_not_implemented/get.html +5 -5
  155. data/vendor/local/share/doc/groonga/en/html/reference/commands_not_implemented/set.html +5 -5
  156. data/vendor/local/share/doc/groonga/en/html/reference/executables/grnslap.html +5 -5
  157. data/vendor/local/share/doc/groonga/en/html/reference/executables/grntest.html +5 -5
  158. data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-httpd.html +5 -5
  159. data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-server-http.html +5 -5
  160. data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-suggest-create-dataset.html +5 -5
  161. data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga.html +5 -5
  162. data/vendor/local/share/doc/groonga/en/html/reference/executables.html +5 -5
  163. data/vendor/local/share/doc/groonga/en/html/reference/function.html +5 -5
  164. data/vendor/local/share/doc/groonga/en/html/reference/functions/edit_distance.html +5 -5
  165. data/vendor/local/share/doc/groonga/en/html/reference/functions/geo_distance.html +5 -5
  166. data/vendor/local/share/doc/groonga/en/html/reference/functions/geo_in_circle.html +5 -5
  167. data/vendor/local/share/doc/groonga/en/html/reference/functions/geo_in_rectangle.html +5 -5
  168. data/vendor/local/share/doc/groonga/en/html/reference/functions/now.html +5 -5
  169. data/vendor/local/share/doc/groonga/en/html/reference/functions/query.html +5 -5
  170. data/vendor/local/share/doc/groonga/en/html/reference/functions/rand.html +5 -5
  171. data/vendor/local/share/doc/groonga/en/html/reference/functions/snippet_html.html +5 -5
  172. data/vendor/local/share/doc/groonga/en/html/reference/functions/sub_filter.html +5 -5
  173. data/vendor/local/share/doc/groonga/en/html/reference/grn_expr/query_syntax.html +5 -5
  174. data/vendor/local/share/doc/groonga/en/html/reference/grn_expr/script_syntax.html +5 -5
  175. data/vendor/local/share/doc/groonga/en/html/reference/grn_expr.html +5 -5
  176. data/vendor/local/share/doc/groonga/en/html/reference/indexing.html +5 -5
  177. data/vendor/local/share/doc/groonga/en/html/reference/log.html +5 -5
  178. data/vendor/local/share/doc/groonga/en/html/reference/normalizers.html +6 -6
  179. data/vendor/local/share/doc/groonga/en/html/reference/output.html +5 -5
  180. data/vendor/local/share/doc/groonga/en/html/reference/pseudo_column.html +5 -5
  181. data/vendor/local/share/doc/groonga/en/html/reference/query_expanders/tsv.html +5 -5
  182. data/vendor/local/share/doc/groonga/en/html/reference/query_expanders.html +5 -5
  183. data/vendor/local/share/doc/groonga/en/html/reference/tables.html +5 -5
  184. data/vendor/local/share/doc/groonga/en/html/reference/tokenizers.html +20 -5
  185. data/vendor/local/share/doc/groonga/en/html/reference/types.html +9 -9
  186. data/vendor/local/share/doc/groonga/en/html/reference.html +12 -7
  187. data/vendor/local/share/doc/groonga/en/html/search.html +5 -5
  188. data/vendor/local/share/doc/groonga/en/html/searchindex.js +1 -1
  189. data/vendor/local/share/doc/groonga/en/html/server/gqtp.html +5 -5
  190. data/vendor/local/share/doc/groonga/en/html/server/http/comparison.html +5 -5
  191. data/vendor/local/share/doc/groonga/en/html/server/http/groonga-httpd.html +5 -5
  192. data/vendor/local/share/doc/groonga/en/html/server/http/groonga.html +5 -5
  193. data/vendor/local/share/doc/groonga/en/html/server/http.html +5 -5
  194. data/vendor/local/share/doc/groonga/en/html/server/package.html +5 -5
  195. data/vendor/local/share/doc/groonga/en/html/server.html +5 -5
  196. data/vendor/local/share/doc/groonga/en/html/spec/gqtp.html +5 -5
  197. data/vendor/local/share/doc/groonga/en/html/spec/search.html +5 -5
  198. data/vendor/local/share/doc/groonga/en/html/spec.html +10 -10
  199. data/vendor/local/share/doc/groonga/en/html/suggest/completion.html +5 -5
  200. data/vendor/local/share/doc/groonga/en/html/suggest/correction.html +5 -5
  201. data/vendor/local/share/doc/groonga/en/html/suggest/introduction.html +5 -5
  202. data/vendor/local/share/doc/groonga/en/html/suggest/suggestion.html +5 -5
  203. data/vendor/local/share/doc/groonga/en/html/suggest/tutorial.html +5 -5
  204. data/vendor/local/share/doc/groonga/en/html/suggest.html +5 -5
  205. data/vendor/local/share/doc/groonga/en/html/troubleshooting/different_results_with_the_same_keyword.html +5 -5
  206. data/vendor/local/share/doc/groonga/en/html/troubleshooting.html +5 -5
  207. data/vendor/local/share/doc/groonga/en/html/tutorial/data.html +5 -5
  208. data/vendor/local/share/doc/groonga/en/html/tutorial/drilldown.html +5 -5
  209. data/vendor/local/share/doc/groonga/en/html/tutorial/index.html +5 -5
  210. data/vendor/local/share/doc/groonga/en/html/tutorial/introduction.html +5 -5
  211. data/vendor/local/share/doc/groonga/en/html/tutorial/lexicon.html +5 -5
  212. data/vendor/local/share/doc/groonga/en/html/tutorial/match_columns.html +5 -5
  213. data/vendor/local/share/doc/groonga/en/html/tutorial/micro_blog.html +5 -5
  214. data/vendor/local/share/doc/groonga/en/html/tutorial/network.html +5 -5
  215. data/vendor/local/share/doc/groonga/en/html/tutorial/patricia_trie.html +5 -5
  216. data/vendor/local/share/doc/groonga/en/html/tutorial/query_expansion.html +5 -5
  217. data/vendor/local/share/doc/groonga/en/html/tutorial/search.html +5 -5
  218. data/vendor/local/share/doc/groonga/en/html/tutorial.html +5 -5
  219. data/vendor/local/share/doc/groonga/ja/html/.buildinfo +1 -1
  220. data/vendor/local/share/doc/groonga/ja/html/_sources/install/centos.txt +3 -3
  221. data/vendor/local/share/doc/groonga/ja/html/_sources/install/debian.txt +43 -3
  222. data/vendor/local/share/doc/groonga/ja/html/_sources/install/fedora.txt +3 -3
  223. data/vendor/local/share/doc/groonga/ja/html/_sources/install/mac_os_x.txt +3 -3
  224. data/vendor/local/share/doc/groonga/ja/html/_sources/install/others.txt +3 -3
  225. data/vendor/local/share/doc/groonga/ja/html/_sources/install/solaris.txt +3 -3
  226. data/vendor/local/share/doc/groonga/ja/html/_sources/install/ubuntu.txt +3 -50
  227. data/vendor/local/share/doc/groonga/ja/html/_sources/install/windows.txt +11 -21
  228. data/vendor/local/share/doc/groonga/ja/html/_sources/news.txt +51 -0
  229. data/vendor/local/share/doc/groonga/ja/html/_sources/reference/api/grn_ctx.txt +49 -0
  230. data/vendor/local/share/doc/groonga/ja/html/_sources/reference/api.txt +8 -1
  231. data/vendor/local/share/doc/groonga/ja/html/_sources/reference/commands/tokenize.txt +196 -0
  232. data/vendor/local/share/doc/groonga/ja/html/_sources/reference/normalizers.txt +1 -1
  233. data/vendor/local/share/doc/groonga/ja/html/_sources/reference/tokenizers.txt +16 -0
  234. data/vendor/local/share/doc/groonga/ja/html/_static/pygments.css +2 -2
  235. data/vendor/local/share/doc/groonga/ja/html/characteristic.html +5 -5
  236. data/vendor/local/share/doc/groonga/ja/html/community.html +5 -5
  237. data/vendor/local/share/doc/groonga/ja/html/contribution/development/com.html +5 -5
  238. data/vendor/local/share/doc/groonga/ja/html/contribution/development/document.html +5 -5
  239. data/vendor/local/share/doc/groonga/ja/html/contribution/development/query.html +5 -5
  240. data/vendor/local/share/doc/groonga/ja/html/contribution/development/release.html +5 -5
  241. data/vendor/local/share/doc/groonga/ja/html/contribution/development/repository.html +5 -5
  242. data/vendor/local/share/doc/groonga/ja/html/contribution/development/test.html +5 -5
  243. data/vendor/local/share/doc/groonga/ja/html/contribution/development.html +5 -5
  244. data/vendor/local/share/doc/groonga/ja/html/contribution/documentation/c-api.html +5 -5
  245. data/vendor/local/share/doc/groonga/ja/html/contribution/documentation/i18n.html +17 -9
  246. data/vendor/local/share/doc/groonga/ja/html/contribution/documentation.html +5 -5
  247. data/vendor/local/share/doc/groonga/ja/html/contribution/report.html +5 -5
  248. data/vendor/local/share/doc/groonga/ja/html/contribution.html +5 -5
  249. data/vendor/local/share/doc/groonga/ja/html/development/travis-ci.html +5 -5
  250. data/vendor/local/share/doc/groonga/ja/html/development.html +5 -5
  251. data/vendor/local/share/doc/groonga/ja/html/genindex.html +31 -7
  252. data/vendor/local/share/doc/groonga/ja/html/geolocation_search.html +5 -5
  253. data/vendor/local/share/doc/groonga/ja/html/index.html +19 -14
  254. data/vendor/local/share/doc/groonga/ja/html/install/centos.html +8 -8
  255. data/vendor/local/share/doc/groonga/ja/html/install/debian.html +44 -12
  256. data/vendor/local/share/doc/groonga/ja/html/install/fedora.html +8 -8
  257. data/vendor/local/share/doc/groonga/ja/html/install/mac_os_x.html +8 -8
  258. data/vendor/local/share/doc/groonga/ja/html/install/others.html +8 -8
  259. data/vendor/local/share/doc/groonga/ja/html/install/solaris.html +8 -8
  260. data/vendor/local/share/doc/groonga/ja/html/install/ubuntu.html +16 -56
  261. data/vendor/local/share/doc/groonga/ja/html/install/windows.html +16 -25
  262. data/vendor/local/share/doc/groonga/ja/html/install.html +12 -12
  263. data/vendor/local/share/doc/groonga/ja/html/limitations.html +5 -5
  264. data/vendor/local/share/doc/groonga/ja/html/news/0.x.html +5 -5
  265. data/vendor/local/share/doc/groonga/ja/html/news/1.0.x.html +5 -5
  266. data/vendor/local/share/doc/groonga/ja/html/news/1.1.x.html +5 -5
  267. data/vendor/local/share/doc/groonga/ja/html/news/1.2.x.html +5 -5
  268. data/vendor/local/share/doc/groonga/ja/html/news/senna.html +5 -5
  269. data/vendor/local/share/doc/groonga/ja/html/news.html +178 -129
  270. data/vendor/local/share/doc/groonga/ja/html/objects.inv +0 -0
  271. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_ctx.html +195 -0
  272. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_expr.html +31 -6
  273. data/vendor/local/share/doc/groonga/ja/html/reference/api.html +17 -11
  274. data/vendor/local/share/doc/groonga/ja/html/reference/cast.html +5 -5
  275. data/vendor/local/share/doc/groonga/ja/html/reference/command/command_version.html +5 -5
  276. data/vendor/local/share/doc/groonga/ja/html/reference/command/output_format.html +5 -5
  277. data/vendor/local/share/doc/groonga/ja/html/reference/command/return_code.html +5 -5
  278. data/vendor/local/share/doc/groonga/ja/html/reference/command.html +7 -6
  279. data/vendor/local/share/doc/groonga/ja/html/reference/commands/cache_limit.html +5 -5
  280. data/vendor/local/share/doc/groonga/ja/html/reference/commands/check.html +5 -5
  281. data/vendor/local/share/doc/groonga/ja/html/reference/commands/clearlock.html +5 -5
  282. data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_create.html +5 -5
  283. data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_list.html +5 -5
  284. data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_remove.html +17 -17
  285. data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_rename.html +5 -5
  286. data/vendor/local/share/doc/groonga/ja/html/reference/commands/define_selector.html +5 -5
  287. data/vendor/local/share/doc/groonga/ja/html/reference/commands/defrag.html +5 -5
  288. data/vendor/local/share/doc/groonga/ja/html/reference/commands/delete.html +5 -5
  289. data/vendor/local/share/doc/groonga/ja/html/reference/commands/dump.html +5 -5
  290. data/vendor/local/share/doc/groonga/ja/html/reference/commands/load.html +5 -5
  291. data/vendor/local/share/doc/groonga/ja/html/reference/commands/log_level.html +5 -5
  292. data/vendor/local/share/doc/groonga/ja/html/reference/commands/log_put.html +5 -5
  293. data/vendor/local/share/doc/groonga/ja/html/reference/commands/log_reopen.html +5 -5
  294. data/vendor/local/share/doc/groonga/ja/html/reference/commands/normalize.html +5 -5
  295. data/vendor/local/share/doc/groonga/ja/html/reference/commands/quit.html +5 -5
  296. data/vendor/local/share/doc/groonga/ja/html/reference/commands/register.html +5 -5
  297. data/vendor/local/share/doc/groonga/ja/html/reference/commands/select.html +5 -5
  298. data/vendor/local/share/doc/groonga/ja/html/reference/commands/shutdown.html +5 -5
  299. data/vendor/local/share/doc/groonga/ja/html/reference/commands/status.html +5 -5
  300. data/vendor/local/share/doc/groonga/ja/html/reference/commands/suggest.html +5 -5
  301. data/vendor/local/share/doc/groonga/ja/html/reference/commands/table_create.html +5 -5
  302. data/vendor/local/share/doc/groonga/ja/html/reference/commands/table_list.html +5 -5
  303. data/vendor/local/share/doc/groonga/ja/html/reference/commands/table_remove.html +10 -10
  304. data/vendor/local/share/doc/groonga/ja/html/reference/commands/tokenize.html +311 -0
  305. data/vendor/local/share/doc/groonga/ja/html/reference/commands/truncate.html +26 -26
  306. data/vendor/local/share/doc/groonga/ja/html/reference/commands_not_implemented/add.html +5 -5
  307. data/vendor/local/share/doc/groonga/ja/html/reference/commands_not_implemented/get.html +5 -5
  308. data/vendor/local/share/doc/groonga/ja/html/reference/commands_not_implemented/set.html +5 -5
  309. data/vendor/local/share/doc/groonga/ja/html/reference/executables/grnslap.html +5 -5
  310. data/vendor/local/share/doc/groonga/ja/html/reference/executables/grntest.html +5 -5
  311. data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-httpd.html +5 -5
  312. data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-server-http.html +5 -5
  313. data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-suggest-create-dataset.html +5 -5
  314. data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga.html +5 -5
  315. data/vendor/local/share/doc/groonga/ja/html/reference/executables.html +5 -5
  316. data/vendor/local/share/doc/groonga/ja/html/reference/function.html +5 -5
  317. data/vendor/local/share/doc/groonga/ja/html/reference/functions/edit_distance.html +5 -5
  318. data/vendor/local/share/doc/groonga/ja/html/reference/functions/geo_distance.html +5 -5
  319. data/vendor/local/share/doc/groonga/ja/html/reference/functions/geo_in_circle.html +5 -5
  320. data/vendor/local/share/doc/groonga/ja/html/reference/functions/geo_in_rectangle.html +5 -5
  321. data/vendor/local/share/doc/groonga/ja/html/reference/functions/now.html +5 -5
  322. data/vendor/local/share/doc/groonga/ja/html/reference/functions/query.html +5 -5
  323. data/vendor/local/share/doc/groonga/ja/html/reference/functions/rand.html +5 -5
  324. data/vendor/local/share/doc/groonga/ja/html/reference/functions/snippet_html.html +5 -5
  325. data/vendor/local/share/doc/groonga/ja/html/reference/functions/sub_filter.html +5 -5
  326. data/vendor/local/share/doc/groonga/ja/html/reference/grn_expr/query_syntax.html +5 -5
  327. data/vendor/local/share/doc/groonga/ja/html/reference/grn_expr/script_syntax.html +5 -5
  328. data/vendor/local/share/doc/groonga/ja/html/reference/grn_expr.html +5 -5
  329. data/vendor/local/share/doc/groonga/ja/html/reference/indexing.html +5 -5
  330. data/vendor/local/share/doc/groonga/ja/html/reference/log.html +5 -5
  331. data/vendor/local/share/doc/groonga/ja/html/reference/normalizers.html +6 -6
  332. data/vendor/local/share/doc/groonga/ja/html/reference/output.html +5 -5
  333. data/vendor/local/share/doc/groonga/ja/html/reference/pseudo_column.html +5 -5
  334. data/vendor/local/share/doc/groonga/ja/html/reference/query_expanders/tsv.html +5 -5
  335. data/vendor/local/share/doc/groonga/ja/html/reference/query_expanders.html +5 -5
  336. data/vendor/local/share/doc/groonga/ja/html/reference/tables.html +5 -5
  337. data/vendor/local/share/doc/groonga/ja/html/reference/tokenizers.html +20 -5
  338. data/vendor/local/share/doc/groonga/ja/html/reference/types.html +9 -9
  339. data/vendor/local/share/doc/groonga/ja/html/reference.html +12 -7
  340. data/vendor/local/share/doc/groonga/ja/html/search.html +5 -5
  341. data/vendor/local/share/doc/groonga/ja/html/searchindex.js +1 -1
  342. data/vendor/local/share/doc/groonga/ja/html/server/gqtp.html +5 -5
  343. data/vendor/local/share/doc/groonga/ja/html/server/http/comparison.html +5 -5
  344. data/vendor/local/share/doc/groonga/ja/html/server/http/groonga-httpd.html +5 -5
  345. data/vendor/local/share/doc/groonga/ja/html/server/http/groonga.html +5 -5
  346. data/vendor/local/share/doc/groonga/ja/html/server/http.html +5 -5
  347. data/vendor/local/share/doc/groonga/ja/html/server/package.html +5 -5
  348. data/vendor/local/share/doc/groonga/ja/html/server.html +5 -5
  349. data/vendor/local/share/doc/groonga/ja/html/spec/gqtp.html +5 -5
  350. data/vendor/local/share/doc/groonga/ja/html/spec/search.html +5 -5
  351. data/vendor/local/share/doc/groonga/ja/html/spec.html +10 -10
  352. data/vendor/local/share/doc/groonga/ja/html/suggest/completion.html +5 -5
  353. data/vendor/local/share/doc/groonga/ja/html/suggest/correction.html +5 -5
  354. data/vendor/local/share/doc/groonga/ja/html/suggest/introduction.html +5 -5
  355. data/vendor/local/share/doc/groonga/ja/html/suggest/suggestion.html +5 -5
  356. data/vendor/local/share/doc/groonga/ja/html/suggest/tutorial.html +5 -5
  357. data/vendor/local/share/doc/groonga/ja/html/suggest.html +5 -5
  358. data/vendor/local/share/doc/groonga/ja/html/troubleshooting/different_results_with_the_same_keyword.html +5 -5
  359. data/vendor/local/share/doc/groonga/ja/html/troubleshooting.html +5 -5
  360. data/vendor/local/share/doc/groonga/ja/html/tutorial/data.html +5 -5
  361. data/vendor/local/share/doc/groonga/ja/html/tutorial/drilldown.html +5 -5
  362. data/vendor/local/share/doc/groonga/ja/html/tutorial/index.html +5 -5
  363. data/vendor/local/share/doc/groonga/ja/html/tutorial/introduction.html +5 -5
  364. data/vendor/local/share/doc/groonga/ja/html/tutorial/lexicon.html +5 -5
  365. data/vendor/local/share/doc/groonga/ja/html/tutorial/match_columns.html +5 -5
  366. data/vendor/local/share/doc/groonga/ja/html/tutorial/micro_blog.html +5 -5
  367. data/vendor/local/share/doc/groonga/ja/html/tutorial/network.html +5 -5
  368. data/vendor/local/share/doc/groonga/ja/html/tutorial/patricia_trie.html +5 -5
  369. data/vendor/local/share/doc/groonga/ja/html/tutorial/query_expansion.html +5 -5
  370. data/vendor/local/share/doc/groonga/ja/html/tutorial/search.html +5 -5
  371. data/vendor/local/share/doc/groonga/ja/html/tutorial.html +5 -5
  372. data/vendor/local/share/man/ja/man1/groonga.1 +3227 -197
  373. data/vendor/local/share/man/man1/groonga.1 +3230 -195
  374. metadata +131 -123
@@ -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
- 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
- }
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
- return GRN_TRUE;
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
- return GRN_TRUE;
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
- grn_id range_id,
197
- VALUE related_object, VALUE *rb_value)
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
- *rb_value = rb_str_new(GRN_TEXT_VALUE(bulk), GRN_TEXT_LEN(bulk));
204
- break;
203
+ *rb_value = rb_str_new(GRN_TEXT_VALUE(bulk), GRN_TEXT_LEN(bulk));
204
+ break;
205
205
  case GRN_DB_BOOL:
206
- *rb_value = GRN_BOOL_VALUE(bulk) ? Qtrue : Qfalse;
207
- break;
206
+ *rb_value = GRN_BOOL_VALUE(bulk) ? Qtrue : Qfalse;
207
+ break;
208
208
  case GRN_DB_INT32:
209
- *rb_value = INT2NUM(GRN_INT32_VALUE(bulk));
210
- break;
209
+ *rb_value = INT2NUM(GRN_INT32_VALUE(bulk));
210
+ break;
211
211
  case GRN_DB_UINT32:
212
- *rb_value = UINT2NUM(GRN_UINT32_VALUE(bulk));
213
- break;
212
+ *rb_value = UINT2NUM(GRN_UINT32_VALUE(bulk));
213
+ break;
214
214
  case GRN_DB_INT64:
215
- *rb_value = LL2NUM(GRN_INT64_VALUE(bulk));
216
- break;
215
+ *rb_value = LL2NUM(GRN_INT64_VALUE(bulk));
216
+ break;
217
217
  case GRN_DB_UINT64:
218
- *rb_value = ULL2NUM(GRN_UINT64_VALUE(bulk));
219
- break;
218
+ *rb_value = ULL2NUM(GRN_UINT64_VALUE(bulk));
219
+ break;
220
220
  case GRN_DB_FLOAT:
221
- *rb_value = rb_float_new(GRN_FLOAT_VALUE(bulk));
222
- break;
221
+ *rb_value = rb_float_new(GRN_FLOAT_VALUE(bulk));
222
+ break;
223
223
  case GRN_DB_TIME:
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;
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
- *rb_value = rb_grn_context_rb_string_new(context,
237
- GRN_TEXT_VALUE(bulk),
238
- GRN_TEXT_LEN(bulk));
239
- break;
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
- int latitude, longitude;
241
+ {
242
+ int latitude, longitude;
243
243
 
244
- GRN_GEO_POINT_VALUE(bulk, latitude, longitude);
245
- *rb_value = rb_grn_tokyo_geo_point_new(latitude, longitude);
246
- }
247
- break;
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
- int latitude, longitude;
249
+ {
250
+ int latitude, longitude;
251
251
 
252
- GRN_GEO_POINT_VALUE(bulk, latitude, longitude);
253
- *rb_value = rb_grn_wgs84_geo_point_new(latitude, longitude);
254
- }
255
- break;
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
- success = GRN_FALSE;
258
- break;
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
- grn_obj *range, grn_id range_id,
267
- VALUE related_object, VALUE *rb_value)
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
- range = grn_ctx_at(context, range_id);
272
+ range = grn_ctx_at(context, range_id);
273
273
  }
274
274
 
275
275
  if (!range)
276
- return GRN_FALSE;
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
- 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;
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
- 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;
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
- success = GRN_FALSE;
321
- break;
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
- grn_obj *range, VALUE related_object)
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
- return Qnil;
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
- related_object, &rb_value))
340
- return rb_value;
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
- range, range_id,
344
- related_object, &rb_value))
345
- return rb_value;
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
- GRN_BULK_HEAD(bulk),
349
- GRN_BULK_VSIZE(bulk));
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
- bulk->header.domain,
358
- grn_ctx_at(context, bulk->header.domain));
357
+ bulk->header.domain,
358
+ grn_ctx_at(context, bulk->header.domain));
359
359
 
360
360
  if (!bulk) {
361
- bulk = grn_obj_open(context, GRN_BULK, 0, GRN_ID_NIL);
362
- rb_grn_context_check(context, object);
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
- grn_obj_reinit(context, bulk, GRN_DB_VOID, 0);
368
- break;
367
+ grn_obj_reinit(context, bulk, GRN_DB_VOID, 0);
368
+ break;
369
369
  case T_SYMBOL:
370
- object = rb_funcall(object, rb_intern("to_s"), 0);
370
+ object = rb_funcall(object, rb_intern("to_s"), 0);
371
371
  case T_STRING:
372
- grn_obj_reinit(context, bulk, GRN_DB_TEXT, 0);
373
- rb_grn_context_text_set(context, bulk, object);
374
- break;
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
- grn_obj_reinit(context, bulk, GRN_DB_INT32, 0);
377
- GRN_INT32_SET(context, bulk, NUM2INT(object));
378
- break;
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
- 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;
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
- grn_obj_reinit(context, bulk, GRN_DB_FLOAT, 0);
394
- GRN_FLOAT_SET(context, bulk, NUM2DBL(object));
395
- break;
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
- grn_obj_reinit(context, bulk, GRN_DB_BOOL, 0);
398
- GRN_BOOL_SET(context, bulk, GRN_TRUE);
399
- break;
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
- grn_obj_reinit(context, bulk, GRN_DB_BOOL, 0);
402
- GRN_BOOL_SET(context, bulk, GRN_FALSE);
403
- break;
401
+ grn_obj_reinit(context, bulk, GRN_DB_BOOL, 0);
402
+ GRN_BOOL_SET(context, bulk, GRN_FALSE);
403
+ break;
404
404
  default:
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;
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
- grn_obj *bulk,
447
- grn_id type_id, grn_obj *type)
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
- type->header.type <= GRN_TABLE_NO_KEY);
465
+ type->header.type <= GRN_TABLE_NO_KEY);
466
466
 
467
467
  switch (type_id) {
468
468
  case GRN_DB_INT32:
469
- int32_value = NUM2INT(object);
470
- string = (const char *)&int32_value;
471
- size = sizeof(int32_value);
472
- break;
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
- uint32_value = NUM2UINT(object);
475
- string = (const char *)&uint32_value;
476
- size = sizeof(uint32_value);
477
- break;
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
- int64_value = NUM2LL(object);
480
- string = (const char *)&int64_value;
481
- size = sizeof(int64_value);
482
- break;
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
- uint64_value = NUM2ULL(object);
485
- string = (const char *)&uint64_value;
486
- size = sizeof(uint64_value);
487
- break;
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
- double_value = NUM2DBL(object);
490
- string = (const char *)&double_value;
491
- size = sizeof(double_value);
492
- break;
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
- VALUE rb_sec, rb_usec;
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
- INT2NUM(1));
514
+ INT2NUM(1));
509
515
 
510
516
  sec = NUM2LL(rb_sec);
511
517
  usec = (int32_t)(NUM2DBL(rb_usec) * 1000000);
512
518
  break;
513
- case T_NIL:
514
- sec = 0;
515
- usec = 0;
516
- break;
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
- time_value = GRN_TIME_PACK(sec, usec);
524
- }
525
- string = (const char *)&time_value;
526
- size = sizeof(time_value);
527
- break;
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
- string = StringValuePtr(object);
532
- size = RSTRING_LEN(object);
533
- range = grn_obj_get_range(context, type);
534
- if (size > range)
535
- rb_raise(rb_eArgError,
536
- "string is too large: expected: %u <= %u",
537
- size, range);
538
- flags |= GRN_OBJ_DO_SHALLOW_COPY;
539
- break;
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
- VALUE rb_geo_point;
544
- VALUE rb_latitude, rb_longitude;
545
- if (type_id == GRN_DB_TOKYO_GEO_POINT) {
546
- rb_geo_point = rb_funcall(rb_cGrnTokyoGeoPoint,
547
- rb_intern("new"), 1, object);
548
- } else {
549
- rb_geo_point = rb_funcall(rb_cGrnWGS84GeoPoint,
550
- rb_intern("new"), 1, object);
551
- }
552
- rb_geo_point = rb_funcall(rb_geo_point, rb_intern("to_msec"), 0);
553
- rb_latitude = rb_funcall(rb_geo_point, rb_intern("latitude"), 0);
554
- rb_longitude = rb_funcall(rb_geo_point, rb_intern("longitude"), 0);
555
- geo_point_value.latitude = NUM2INT(rb_latitude);
556
- geo_point_value.longitude = NUM2INT(rb_longitude);
557
- string = (const char *)&geo_point_value;
558
- size = sizeof(geo_point_value);
559
- }
560
- break;
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
- rb_type_object = GRNOBJECT2RVAL(Qnil, context, type, GRN_FALSE);
568
- rb_raise(rb_eArgError,
569
- "unbulkable type: %s",
570
- rb_grn_inspect(rb_type_object));
571
- break;
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
- if (table_type_p &&
574
- (NIL_P(object) || (string_p && RSTRING_LEN(object) == 0))) {
575
- record_id = GRN_ID_NIL;
576
- string = (const char *)&record_id;
577
- size = sizeof(record_id);
578
- if (bulk && bulk->header.domain != type_id) {
579
- grn_obj_reinit(context, bulk, type_id, 0);
580
- }
581
- } else {
582
- return RVAL2GRNBULK(object, context, bulk);
583
- }
584
- break;
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
- bulk = grn_obj_open(context, GRN_BULK, flags, GRN_ID_NIL);
589
- rb_grn_context_check(context, object);
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
- return Qnil;
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
- const char *_value;
612
- unsigned int weight, length;
613
- grn_id domain;
614
-
615
- length = grn_vector_get_element(context, vector, i,
616
- &_value, &weight, &domain);
617
- grn_obj_reinit(context, &value, domain, 0);
618
- grn_bulk_write(context, &value, _value, length);
619
- rb_ary_push(array, GRNOBJ2RVAL(Qnil, context, &value, Qnil));
620
- /* UINT2NUM(weight); */ /* TODO: How handle weight? */
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
- return vector;
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
- GRN_VOID_INIT(&(data.value_buffer));
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
- return Qnil;
720
-
721
- array = rb_ary_new();
722
- current = (grn_id *)GRN_BULK_HEAD(uvector);
723
- end = (grn_id *)GRN_BULK_CURR(uvector);
724
- while (current < end) {
725
- rb_ary_push(array, UINT2NUM(*current));
726
- current++;
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
- grn_obj *
733
- rb_grn_uvector_from_ruby_object (VALUE object, grn_ctx *context,
734
- grn_obj *uvector, VALUE related_object)
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 *values;
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
- if (NIL_P(object))
740
- return NULL;
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
- values = RARRAY_PTR(object);
849
+ rb_values = RARRAY_PTR(object);
744
850
  for (i = 0; i < n; i++) {
745
- VALUE value;
746
- grn_id id;
747
- void *grn_value;
748
-
749
- value = values[i];
750
- switch (TYPE(value)) {
751
- case T_FIXNUM:
752
- id = NUM2UINT(value);
753
- break;
754
- default:
755
- if (rb_respond_to(value, rb_intern("record_raw_id"))) {
756
- id = NUM2UINT(rb_funcall(value, rb_intern("record_raw_id"), 0));
757
- } else {
758
- grn_obj_unlink(context, uvector);
759
- rb_raise(rb_eArgError,
760
- "uvector value should be one of "
761
- "[Fixnum or object that has #record_raw_id]: "
762
- "%s (%s): %s",
763
- rb_grn_inspect(value),
764
- rb_grn_inspect(object),
765
- rb_grn_inspect(related_object));
766
- }
767
- break;
768
- }
769
- grn_value = &id;
770
- grn_bulk_write(context, uvector, grn_value, sizeof(grn_id));
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
- grn_obj *value,
779
- grn_obj *range,
780
- VALUE related_object)
961
+ grn_obj *value,
962
+ grn_obj *range,
963
+ VALUE related_object)
781
964
  {
782
965
  if (!value)
783
- return Qnil;
966
+ return Qnil;
784
967
 
785
968
  switch (value->header.type) {
786
969
  case GRN_VOID:
787
- return Qnil;
788
- break;
970
+ return Qnil;
971
+ break;
789
972
  case GRN_BULK:
790
- if (GRN_BULK_EMPTYP(value))
791
- return Qnil;
792
- if (value->header.domain == GRN_ID_NIL && range)
793
- value->header.domain = grn_obj_id(context, range);
794
- return GRNBULK2RVAL(context, value, range, related_object);
795
- break;
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
- VALUE rb_value, rb_range = Qnil;
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
- return GRNVECTOR2RVAL(context, value);
817
- break;
983
+ return GRNVECTOR2RVAL(context, value);
984
+ break;
818
985
  default:
819
- rb_raise(rb_eGrnError,
820
- "unsupported value type: %s(%#x): %s",
821
- rb_grn_inspect_type(value->header.type),
822
- value->header.type,
823
- rb_grn_inspect(related_object));
824
- break;
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
- return GRNOBJECT2RVAL(Qnil, context, value, GRN_FALSE);
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
- VALUE related_object)
1002
+ VALUE related_object)
836
1003
  {
837
1004
  VALUE rb_id;
838
1005
 
839
1006
  if (NIL_P(object))
840
- return Qnil;
1007
+ return Qnil;
841
1008
 
842
1009
  if (RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnRecord))) {
843
- VALUE rb_table;
844
- rb_table = rb_funcall(object, rb_intern("table"), 0);
845
- if (table && RVAL2GRNOBJECT(rb_table, &context) != table) {
846
- VALUE rb_expected_table;
847
-
848
- rb_expected_table =
849
- GRNOBJECT2RVAL(Qnil, context, table, GRN_FALSE);
850
- rb_raise(rb_eGrnError,
851
- "wrong table: expected <%s>: actual <%s>",
852
- rb_grn_inspect(rb_expected_table),
853
- rb_grn_inspect(rb_table));
854
- }
855
- rb_id = rb_funcall(object, rb_intern("id"), 0);
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
- rb_id = object;
1024
+ rb_id = object;
858
1025
  }
859
1026
 
860
1027
  if (!RVAL2CBOOL(rb_obj_is_kind_of(rb_id, rb_cInteger)))
861
- rb_raise(rb_eGrnError,
862
- "should be unsigned integer or Groogna::Record: <%s>: <%s>",
863
- rb_grn_inspect(object),
864
- rb_grn_inspect(related_object));
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
- grn_obj *table, VALUE related_object)
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
- grn_obj *key, grn_id domain_id, grn_obj *domain,
884
- VALUE related_object)
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
- return RVAL2GRNBULK(rb_key, context, key);
1056
+ return RVAL2GRNBULK(rb_key, context, key);
890
1057
 
891
1058
  switch (domain->header.type) {
892
1059
  case GRN_TYPE:
893
- return RVAL2GRNBULK_WITH_TYPE(rb_key, context, key, domain_id, domain);
894
- break;
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
- id = RVAL2GRNID(rb_key, context, domain, related_object);
900
- break;
1066
+ id = RVAL2GRNID(rb_key, context, domain, related_object);
1067
+ break;
901
1068
  default:
902
- if (!RVAL2CBOOL(rb_obj_is_kind_of(rb_key, rb_cInteger)))
903
- rb_raise(rb_eGrnError,
904
- "should be unsigned integer: <%s>: <%s>",
905
- rb_grn_inspect(rb_key),
906
- rb_grn_inspect(related_object));
907
-
908
- id = NUM2UINT(rb_key);
909
- break;
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
- grn_obj *value, grn_id type_id, grn_obj *type)
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
- type->header.type <= GRN_TABLE_NO_KEY);
1091
+ type->header.type <= GRN_TABLE_NO_KEY);
925
1092
  if (!string_p) {
926
- return RVAL2GRNBULK_WITH_TYPE(object, context, value, type_id, type);
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
- if (value) {
931
- if (value->header.domain != type_id) {
932
- grn_obj_reinit(context, value, type_id, 0);
933
- }
934
- } else {
935
- value = grn_obj_open(context, GRN_BULK, 0, type_id);
936
- rb_grn_context_check(context, object);
937
- }
938
- GRN_RECORD_SET(context, value, GRN_ID_NIL);
939
- return value;
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
- if (*_obj) {
950
- grn_obj_unlink(context, *_obj); /* TODO: reduce memory allocation */
951
- }
952
- *_obj = RVAL2GRNOBJECT(rb_object, &context);
1116
+ if (*_obj) {
1117
+ grn_obj_unlink(context, *_obj); /* TODO: reduce memory allocation */
1118
+ }
1119
+ *_obj = RVAL2GRNOBJECT(rb_object, &context);
953
1120
  } else {
954
- *_obj = RVAL2GRNBULK(rb_object, context, *_obj);
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
- grn_obj *obj, VALUE related_object)
1129
+ grn_obj *obj, VALUE related_object)
963
1130
  {
964
1131
  if (!obj)
965
- return Qnil;
1132
+ return Qnil;
966
1133
 
967
1134
  /* if (NIL_P(klass)) */
968
- /* klass = GRNOBJECT2RCLASS(obj); */
1135
+ /* klass = GRNOBJECT2RCLASS(obj); */
969
1136
 
970
1137
  switch (obj->header.type) {
971
1138
  case GRN_VOID:
972
- if (GRN_BULK_VSIZE(obj) > 0)
973
- return rb_str_new(GRN_BULK_HEAD(obj), GRN_BULK_VSIZE(obj));
974
- else
975
- return Qnil;
976
- break;
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
- return GRNBULK2RVAL(context, obj, NULL, related_object);
979
- break;
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
- rb_raise(rb_eTypeError,
1006
- "unsupported groonga object: %s(%#x): <%s>",
1007
- rb_grn_inspect_type(obj->header.type),
1008
- obj->header.type,
1009
- rb_grn_inspect(related_object));
1010
- break;
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;