rroonga 0.9.4-x86-mingw32 → 0.9.5-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. data/NEWS.ja.rdoc +29 -0
  2. data/NEWS.rdoc +29 -0
  3. data/Rakefile +6 -6
  4. data/ext/groonga/rb-grn-array.c +1 -1
  5. data/ext/groonga/rb-grn-context.c +15 -28
  6. data/ext/groonga/rb-grn-exception.c +46 -1
  7. data/ext/groonga/rb-grn-expression.c +22 -13
  8. data/ext/groonga/rb-grn-fix-size-column.c +2 -8
  9. data/ext/groonga/rb-grn-hash.c +8 -1
  10. data/ext/groonga/rb-grn-object.c +1 -1
  11. data/ext/groonga/rb-grn-patricia-trie.c +23 -1
  12. data/ext/groonga/rb-grn-table-key-support.c +22 -0
  13. data/ext/groonga/rb-grn-table.c +37 -5
  14. data/ext/groonga/rb-grn-utils.c +20 -2
  15. data/ext/groonga/rb-grn.h +1 -1
  16. data/ext/groonga/rb-groonga.c +76 -38
  17. data/extconf.rb +17 -1
  18. data/html/developer.html +32 -7
  19. data/html/footer.html.erb +5 -0
  20. data/html/heading-mark.svg +393 -0
  21. data/html/index.html +33 -3
  22. data/lib/1.8/groonga.so +0 -0
  23. data/lib/1.9/groonga.so +0 -0
  24. data/lib/groonga.rb +3 -7
  25. data/lib/groonga/context.rb +2 -13
  26. data/lib/groonga/expression-builder.rb +273 -67
  27. data/lib/groonga/pagination.rb +143 -0
  28. data/lib/groonga/record.rb +2 -0
  29. data/lib/groonga/schema.rb +140 -29
  30. data/pkg/rroonga-0.9.5/NEWS.ja.rdoc +156 -0
  31. data/pkg/rroonga-0.9.5/NEWS.rdoc +158 -0
  32. data/pkg/rroonga-0.9.5/README.ja.rdoc +65 -0
  33. data/pkg/rroonga-0.9.5/README.rdoc +66 -0
  34. data/pkg/rroonga-0.9.5/text/TUTORIAL.ja.rdoc +394 -0
  35. data/pkg/rroonga-0.9.5/text/expression.rdoc +285 -0
  36. data/rroonga-build.rb +2 -2
  37. data/test-unit/Rakefile +40 -0
  38. data/test-unit/TODO +5 -0
  39. data/test-unit/bin/testrb +5 -0
  40. data/test-unit/html/classic.html +15 -0
  41. data/test-unit/html/index.html +25 -0
  42. data/test-unit/html/index.html.ja +27 -0
  43. data/test-unit/lib/test/unit.rb +323 -0
  44. data/test-unit/lib/test/unit/assertionfailederror.rb +25 -0
  45. data/test-unit/lib/test/unit/assertions.rb +1230 -0
  46. data/test-unit/lib/test/unit/attribute.rb +125 -0
  47. data/test-unit/lib/test/unit/autorunner.rb +360 -0
  48. data/test-unit/lib/test/unit/collector.rb +36 -0
  49. data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
  50. data/test-unit/lib/test/unit/collector/dir.rb +108 -0
  51. data/test-unit/lib/test/unit/collector/load.rb +144 -0
  52. data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
  53. data/test-unit/lib/test/unit/color-scheme.rb +102 -0
  54. data/test-unit/lib/test/unit/color.rb +96 -0
  55. data/test-unit/lib/test/unit/diff.rb +724 -0
  56. data/test-unit/lib/test/unit/error.rb +130 -0
  57. data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
  58. data/test-unit/lib/test/unit/failure.rb +136 -0
  59. data/test-unit/lib/test/unit/fixture.rb +176 -0
  60. data/test-unit/lib/test/unit/notification.rb +129 -0
  61. data/test-unit/lib/test/unit/omission.rb +191 -0
  62. data/test-unit/lib/test/unit/pending.rb +150 -0
  63. data/test-unit/lib/test/unit/priority.rb +180 -0
  64. data/test-unit/lib/test/unit/runner/console.rb +52 -0
  65. data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
  66. data/test-unit/lib/test/unit/runner/tap.rb +8 -0
  67. data/test-unit/lib/test/unit/testcase.rb +476 -0
  68. data/test-unit/lib/test/unit/testresult.rb +89 -0
  69. data/test-unit/lib/test/unit/testsuite.rb +110 -0
  70. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
  71. data/test-unit/lib/test/unit/ui/console/testrunner.rb +466 -0
  72. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +63 -0
  73. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +92 -0
  74. data/test-unit/lib/test/unit/ui/testrunner.rb +28 -0
  75. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
  76. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
  77. data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
  78. data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
  79. data/test-unit/lib/test/unit/util/observable.rb +90 -0
  80. data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
  81. data/test-unit/lib/test/unit/version.rb +7 -0
  82. data/test-unit/sample/adder.rb +13 -0
  83. data/test-unit/sample/subtracter.rb +12 -0
  84. data/test-unit/sample/test_adder.rb +20 -0
  85. data/test-unit/sample/test_subtracter.rb +20 -0
  86. data/test-unit/sample/test_user.rb +23 -0
  87. data/test-unit/test/collector/test-descendant.rb +133 -0
  88. data/test-unit/test/collector/test-load.rb +442 -0
  89. data/test-unit/test/collector/test_dir.rb +406 -0
  90. data/test-unit/test/collector/test_objectspace.rb +100 -0
  91. data/test-unit/test/run-test.rb +15 -0
  92. data/test-unit/test/test-attribute.rb +86 -0
  93. data/test-unit/test/test-color-scheme.rb +67 -0
  94. data/test-unit/test/test-color.rb +47 -0
  95. data/test-unit/test/test-diff.rb +518 -0
  96. data/test-unit/test/test-emacs-runner.rb +60 -0
  97. data/test-unit/test/test-fixture.rb +287 -0
  98. data/test-unit/test/test-notification.rb +33 -0
  99. data/test-unit/test/test-omission.rb +81 -0
  100. data/test-unit/test/test-pending.rb +70 -0
  101. data/test-unit/test/test-priority.rb +119 -0
  102. data/test-unit/test/test-testcase.rb +544 -0
  103. data/test-unit/test/test_assertions.rb +1151 -0
  104. data/test-unit/test/test_error.rb +26 -0
  105. data/test-unit/test/test_failure.rb +33 -0
  106. data/test-unit/test/test_testresult.rb +113 -0
  107. data/test-unit/test/test_testsuite.rb +129 -0
  108. data/test-unit/test/testunit-test-util.rb +14 -0
  109. data/test-unit/test/ui/test_testrunmediator.rb +20 -0
  110. data/test-unit/test/util/test-method-owner-finder.rb +38 -0
  111. data/test-unit/test/util/test_backtracefilter.rb +41 -0
  112. data/test-unit/test/util/test_observable.rb +102 -0
  113. data/test-unit/test/util/test_procwrapper.rb +36 -0
  114. data/test/groonga-test-utils.rb +3 -2
  115. data/test/run-test.rb +14 -2
  116. data/test/test-column.rb +7 -7
  117. data/test/test-context-select.rb +34 -11
  118. data/test/test-exception.rb +3 -0
  119. data/test/test-expression-builder.rb +11 -0
  120. data/test/test-expression.rb +3 -6
  121. data/test/test-gqtp.rb +3 -5
  122. data/test/test-pagination.rb +249 -0
  123. data/test/test-record.rb +36 -8
  124. data/test/test-remote.rb +11 -4
  125. data/test/test-schema-create-table.rb +251 -0
  126. data/test/test-schema.rb +4 -24
  127. data/test/test-table-offset-and-limit.rb +3 -5
  128. data/test/test-table-select-mecab.rb +80 -0
  129. data/test/test-table-select-weight.rb +104 -0
  130. data/test/test-table.rb +22 -4
  131. data/test/test-version.rb +1 -1
  132. data/text/TUTORIAL.ja.rdoc +2 -0
  133. data/text/expression.rdoc +1 -0
  134. data/vendor/local/bin/grntest.exe +0 -0
  135. data/vendor/local/bin/groonga.exe +0 -0
  136. data/vendor/local/bin/libgroonga-0.dll +0 -0
  137. data/vendor/local/include/{groonga.h → groonga/groonga.h} +93 -32
  138. data/vendor/local/lib/groonga/modules/functions/cast.dll +0 -0
  139. data/vendor/local/lib/groonga/modules/functions/cast.la +41 -0
  140. data/vendor/local/lib/pkgconfig/groonga.pc +12 -0
  141. data/vendor/local/share/groonga/admin_html/css/admin.css +104 -0
  142. data/vendor/local/share/groonga/admin_html/css/ui-lightness/jquery-ui-1.8.1.custom.css +486 -0
  143. data/vendor/local/share/groonga/admin_html/index.html +1355 -0
  144. data/vendor/local/share/groonga/admin_html/js/jquery-1.4.2.min.js +154 -0
  145. data/vendor/local/share/groonga/admin_html/js/jquery-ui-1.8.1.custom.min.js +756 -0
  146. data/vendor/local/share/groonga/munin/plugins/groonga_cpu_load +47 -0
  147. data/vendor/local/share/groonga/munin/plugins/groonga_cpu_time +57 -0
  148. data/vendor/local/share/groonga/munin/plugins/groonga_disk +162 -0
  149. data/vendor/local/share/groonga/munin/plugins/groonga_memory +51 -0
  150. data/vendor/local/share/groonga/munin/plugins/groonga_n_records +110 -0
  151. data/vendor/local/share/groonga/munin/plugins/groonga_query_performance +133 -0
  152. data/vendor/local/share/groonga/munin/plugins/groonga_status +84 -0
  153. metadata +126 -36
@@ -0,0 +1,104 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2010 Kouhei Sutou <kou@clear-code.com>
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License version 2.1 as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+
18
+ class TableSelectWeightTest < Test::Unit::TestCase
19
+ include GroongaTestUtils
20
+
21
+ setup :setup_database
22
+
23
+ setup
24
+ def setup_tables
25
+ Groonga::Schema.define do |schema|
26
+ schema.create_table("Users",
27
+ :type => :hash,
28
+ :key_type => "ShortText") do |table|
29
+ end
30
+
31
+ schema.create_table("Comments") do |table|
32
+ table.short_text("title")
33
+ table.text("content")
34
+ table.time("created_at")
35
+ table.reference("user", "Users")
36
+ end
37
+
38
+ schema.create_table("Terms",
39
+ :type => :patricia_trie,
40
+ :default_tokenizer => "TokenBigram") do |table|
41
+ table.index("Comments.title", :with_section => true)
42
+ table.index("Comments.content", :with_section => true)
43
+ end
44
+
45
+ schema.change_table("Users") do |table|
46
+ table.index("Comments.user")
47
+ end
48
+ end
49
+ end
50
+
51
+ setup
52
+ def setup_comments
53
+ @comments = context["Comments"]
54
+ @hello = @comments.add(:title => "Hello",
55
+ :content => "Hello Good-bye!",
56
+ :created_at => Time.parse("2009-08-09"),
57
+ :user => "morita")
58
+ @hello_only_in_content =
59
+ @comments.add(:title => "(no title)",
60
+ :content => "Hello! Hello! Hello!",
61
+ :created_at => Time.parse("2009-07-09"))
62
+ @test = @comments.add(:title => "title",
63
+ :content => "test",
64
+ :created_at => Time.parse("2009-06-09"),
65
+ :user => "gunyara-kun")
66
+ @japanese =
67
+ @comments.add(:title => "日本語",
68
+ :content => "うちのボロTVはまだ現役です",
69
+ :created_at => Time.parse("2009-06-09"),
70
+ :user => "darashi")
71
+ end
72
+
73
+ def test_full_text_search
74
+ result = @comments.select do |record|
75
+ record.match("Hello") do |match_record|
76
+ (match_record.title * 100) |
77
+ match_record.content
78
+ end
79
+ end
80
+ assert_equal_select_result([["Hello", 101], ["(no title)", 3]],
81
+ result) do |record|
82
+ [record.title, record.score]
83
+ end
84
+ end
85
+
86
+ def test_reference
87
+ result = @comments.select do |record|
88
+ full_text_match = record.match("Hello") do |match_record|
89
+ (match_record.title * 100) |
90
+ match_record.content
91
+ end
92
+ reference_match = record.match("darashi") do |match_record|
93
+ match_record.user * 1000
94
+ end
95
+ full_text_match | reference_match
96
+ end
97
+ assert_equal_select_result([["Hello", 101],
98
+ ["(no title)", 3],
99
+ ["日本語", 1000]],
100
+ result) do |record|
101
+ [record.title, record.score]
102
+ end
103
+ end
104
+ end
data/test/test-table.rb CHANGED
@@ -46,15 +46,17 @@ class TableTest < Test::Unit::TestCase
46
46
 
47
47
  def test_temporary_table_define_column_default_persistent
48
48
  table = Groonga::Hash.create
49
- name = table.define_column("name", "ShortText")
50
- assert_predicate(name, :temporary?)
49
+ assert_raise(Groonga::InvalidArgument) do
50
+ table.define_column("name", "ShortText")
51
+ end
51
52
  end
52
53
 
53
54
  def test_temporary_table_define_index_column_default_persistent
54
55
  bookmarks = Groonga::Hash.create(:name => "Bookmarks")
55
56
  terms = Groonga::Hash.create
56
- url = terms.define_index_column("url", bookmarks)
57
- assert_predicate(url, :temporary?)
57
+ assert_raise(Groonga::InvalidArgument) do
58
+ terms.define_index_column("url", bookmarks)
59
+ end
58
60
  end
59
61
 
60
62
  def test_define_column_default_persistent
@@ -430,6 +432,22 @@ class TableTest < Test::Unit::TestCase
430
432
  bookmark["title"],
431
433
  bookmark.key]
432
434
  end)
435
+ assert_equal([[2, "groonga", "http://groonga.org/"],
436
+ [1, "Ruby", "http://ruby-lang.org/"]],
437
+ records.group(%w".bookmark").collect do |record|
438
+ bookmark = record.key
439
+ [record.n_sub_records,
440
+ bookmark["title"],
441
+ bookmark.key]
442
+ end)
443
+ end
444
+
445
+ def test_group_with_unknown_key
446
+ bookmarks = Groonga::Hash.create(:name => "Bookmarks")
447
+ message = "unknown group key: <\"nonexistent\">: <#{bookmarks.inspect}>"
448
+ assert_raise(ArgumentError.new(message)) do
449
+ bookmarks.group("nonexistent")
450
+ end
433
451
  end
434
452
 
435
453
  def test_union!
data/test/test-version.rb CHANGED
@@ -20,7 +20,7 @@ class VersionTest < Test::Unit::TestCase
20
20
  end
21
21
 
22
22
  def test_version
23
- assert_match(/\A\d+\.\d+\.\d+\z/, Groonga.version)
23
+ assert_match(/\A\d+\.\d+\.\d+(?:\.\d+-[a-zA-Z\d]+)?\z/, Groonga.version)
24
24
  assert_match(Groonga.version, Groonga::VERSION.join("."))
25
25
  end
26
26
 
@@ -1,3 +1,5 @@
1
+ # -*- coding: utf-8 -*-
2
+
1
3
  = チュートリアル
2
4
 
3
5
  このページでは簡単なアプリケーションの作成を通して
data/text/expression.rdoc CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
 
2
3
  = grn式 (grn_expr)
3
4
 
Binary file
Binary file
Binary file
@@ -106,6 +106,10 @@ typedef enum {
106
106
  GRN_RETRY_MAX = -64,
107
107
  GRN_INCOMPATIBLE_FILE_FORMAT = -65,
108
108
  GRN_UPDATE_NOT_ALLOWED = -66,
109
+ GRN_TOO_SMALL_OFFSET = -67,
110
+ GRN_TOO_LARGE_OFFSET = -68,
111
+ GRN_TOO_SMALL_LIMIT = -69,
112
+ GRN_CAS_ERROR = -70
109
113
  } grn_rc;
110
114
 
111
115
  GRN_API grn_rc grn_init(void);
@@ -138,7 +142,8 @@ typedef enum {
138
142
  GRN_CONTENT_NONE = 0,
139
143
  GRN_CONTENT_TSV,
140
144
  GRN_CONTENT_JSON,
141
- GRN_CONTENT_XML
145
+ GRN_CONTENT_XML,
146
+ GRN_CONTENT_MSGPACK
142
147
  } grn_content_type;
143
148
 
144
149
  typedef struct _grn_obj grn_obj;
@@ -251,6 +256,7 @@ typedef unsigned short int grn_obj_flags;
251
256
  #define GRN_OBJ_KEY_UINT (0x00<<3)
252
257
  #define GRN_OBJ_KEY_INT (0x01<<3)
253
258
  #define GRN_OBJ_KEY_FLOAT (0x02<<3)
259
+ #define GRN_OBJ_KEY_GEO_POINT (0x03<<3)
254
260
 
255
261
  #define GRN_OBJ_KEY_WITH_SIS (0x01<<6)
256
262
  #define GRN_OBJ_KEY_NORMALIZE (0x01<<7)
@@ -481,7 +487,8 @@ GRN_API grn_obj *grn_ctx_at(grn_ctx *ctx, grn_id id);
481
487
  GRN_API grn_obj *grn_type_create(grn_ctx *ctx, const char *name, unsigned name_size,
482
488
  grn_obj_flags flags, unsigned int size);
483
489
 
484
- GRN_API grn_rc grn_db_load(grn_ctx *ctx, const char *path);
490
+ GRN_API grn_rc grn_db_register(grn_ctx *ctx, const char *path);
491
+ GRN_API grn_rc grn_db_register_by_name(grn_ctx *ctx, const char *name);
485
492
 
486
493
  /**
487
494
  * grn_proc_create:
@@ -502,18 +509,17 @@ typedef struct {
502
509
  grn_obj value;
503
510
  } grn_expr_var;
504
511
 
505
- typedef grn_rc grn_proc_init_func(grn_ctx *ctx, const char *path);
512
+ typedef grn_rc (*grn_module_func)(grn_ctx *ctx);
506
513
 
507
514
  typedef enum {
508
515
  GRN_PROC_TOKENIZER = 1,
509
- GRN_PROC_PROCEDURE,
516
+ GRN_PROC_COMMAND,
510
517
  GRN_PROC_FUNCTION,
511
518
  GRN_PROC_HOOK
512
519
  } grn_proc_type;
513
520
 
514
521
  GRN_API grn_obj *grn_proc_create(grn_ctx *ctx,
515
- const char *name, unsigned name_size,
516
- const char *path, grn_proc_type type,
522
+ const char *name, unsigned name_size, grn_proc_type type,
517
523
  grn_proc_func *init, grn_proc_func *next, grn_proc_func *fin,
518
524
  unsigned nvars, grn_expr_var *vars);
519
525
  /**
@@ -658,22 +664,57 @@ typedef grn_obj grn_table_cursor;
658
664
  #define GRN_CURSOR_BY_KEY (0x00<<3)
659
665
  #define GRN_CURSOR_BY_ID (0x01<<3)
660
666
  #define GRN_CURSOR_PREFIX (0x01<<4)
667
+ #define GRN_CURSOR_SIZE_BY_BIT (0x01<<5)
661
668
 
662
669
  /**
663
670
  * grn_table_cursor_open:
664
671
  * @table: 対象table
665
- * @min: keyの下限 (NULLは下限なしと見なす)
666
- * @min_size: @minのsize
667
- * @max: keyの上限 (NULLは上限なしと見なす)
668
- * @max_size: @maxのsize
672
+ * @min: keyの下限 (NULLは下限なしと見なす)、GRN_CURSOR_PREFIXについては後述
673
+ * @min_size: @minのsize、GRN_CURSOR_PREFIXについては後述
674
+ * @max: keyの上限 (NULLは上限なしと見なす)、GRN_CURSOR_PREFIXについては後述
675
+ * @max_size: @maxのsize、GRN_CURSOR_PREFIXについては無視される場合がある
669
676
  * @flags: GRN_CURSOR_ASCENDINGを指定すると昇順にレコードを取り出す。
670
677
  * GRN_CURSOR_DESCENDINGを指定すると降順にレコードを取り出す。
678
+ * (下記GRN_CURSOR_PREFIXを指定し、
679
+ * keyが近いレコードを取得する場合、
680
+ * もしくは、common prefix searchを行う場合には、
681
+ * GRN_CURSOR_ASCENDING/DESCENDINGは無視される)
671
682
  * GRN_CURSOR_GTを指定するとminに一致したkeyをcursorの範囲に含まない。
683
+ * (minがNULLの場合もしくは、下記GRN_CURSOR_PREFIXを指定し、
684
+ * keyが近いレコードを取得する場合、
685
+ * もしくは、common prefix searchを行う場合には、
686
+ * GRN_CURSOR_GTは無視される)
672
687
  * GRN_CURSOR_LTを指定するとmaxに一致したkeyをcursorの範囲に含まない。
688
+ * (maxがNULLの場合もしくは、下記GRN_CURSOR_PREFIXを指定した場合には、
689
+ * GRN_CURSOR_LTは無視される)
673
690
  * GRN_CURSOR_BY_IDを指定するとID順にレコードを取り出す。
691
+ * (下記GRN_CURSOR_PREFIXを指定した場合には、
692
+ * GRN_CURSOR_BY_IDは無視される)
674
693
  * GRN_OBJ_TABLE_PAT_KEYを指定したtableについては、
675
694
  * GRN_CURSOR_BY_KEYを指定するとkey順にレコードを取り出す。
676
- * (GRN_OBJ_TABLE_HASH_KEY,GRN_OBJ_TABLE_NO_KEYではGRN_CURSOR_BY_KEYは無視される)
695
+ * (GRN_OBJ_TABLE_HASH_KEY,GRN_OBJ_TABLE_NO_KEYを指定したテーブルでは
696
+ * GRN_CURSOR_BY_KEYは無視される)
697
+ * GRN_CURSOR_PREFIXを指定すると、
698
+ * GRN_OBJ_TABLE_PAT_KEYを指定したテーブルに関する
699
+ * 下記のレコードを取り出すカーソルが作成される。
700
+ * maxがNULLの場合には、minとkeyが前方一致するレコードを取り出す。
701
+ * maxが指定され、かつ、テーブルのkeyがShortText型である場合、
702
+ * maxとcommon prefix searchを行い、
703
+ * common prefixがmin_sizeバイト以上のレコードを取り出す。
704
+ * この場合、minパラメータは無視される。
705
+ * maxが指定され、かつ、テーブルのkeyが固定長型の場合、
706
+ * maxと値が近い順番にレコードを取り出す。
707
+ * ただし、keyのパトリシア木で、min_sizeバイト未満のビットに対する
708
+ * ノードで、maxと異なった方向にあるノードに対応するレコードについては
709
+ * 取り出さない。
710
+ * 「keyが近い」ことの定義は、keyの型によって異なる。
711
+ * (GeoPoint型では、地理的に近いものほど近いものとし、
712
+ * 数値型では、数値が近いものほど近いものとする)
713
+ * この場合、maxで与えられるポインタが指す値は、
714
+ * 対象テーブルのkeyサイズと同じか超える幅である必要がある。
715
+ * minとmax_sizeは無視される。
716
+ * GRN_CURSOR_BY_ID/GRN_CURSOR_BY_KEY/GRN_CURSOR_PREFIXの3フラグは、
717
+ * 同時に指定することができない。
677
718
  * @offset: 該当する範囲のレコードのうち、(0ベースで)offset番目からレコードを取り出す。
678
719
  * @limit: 該当する範囲のレコードのうち、limit件のみを取り出す。
679
720
  * -1が指定された場合は、全件が指定されたものとみなす。
@@ -1319,6 +1360,15 @@ GRN_API grn_rc grn_obj_clear_lock(grn_ctx *ctx, grn_obj *obj);
1319
1360
  **/
1320
1361
  GRN_API unsigned int grn_obj_is_locked(grn_ctx *ctx, grn_obj *obj);
1321
1362
 
1363
+ /**
1364
+ * grn_obj_defrag;
1365
+ * @obj: 対象object
1366
+ *
1367
+ * objの占有するDBファイル領域のうち、可能な領域をthresholdを指標としてフラグメントの解消を行う。
1368
+ * フラグメント解消が実行されたセグメントの数を返す。
1369
+ **/
1370
+ GRN_API int grn_obj_defrag(grn_ctx *ctx, grn_obj *obj, int threshold);
1371
+
1322
1372
  /**
1323
1373
  * grn_obj_db:
1324
1374
  * @obj: 対象object
@@ -1658,14 +1708,16 @@ struct _grn_obj_format {
1658
1708
  int nhits;
1659
1709
  int offset;
1660
1710
  int limit;
1711
+ int hits_offset;
1661
1712
  int flags;
1662
1713
  };
1663
1714
 
1664
- #define GRN_OBJ_FORMAT_INIT(format,format_nhits,format_offset,format_limit) do { \
1715
+ #define GRN_OBJ_FORMAT_INIT(format,format_nhits,format_offset,format_limit,format_hits_offset) do { \
1665
1716
  GRN_PTR_INIT(&(format)->columns, GRN_OBJ_VECTOR, GRN_ID_NIL);\
1666
1717
  (format)->nhits = (format_nhits);\
1667
1718
  (format)->offset = (format_offset);\
1668
1719
  (format)->limit = (format_limit);\
1720
+ (format)->hits_offset = (format_hits_offset);\
1669
1721
  } while (0)
1670
1722
 
1671
1723
  #define GRN_OBJ_FORMAT_FIN(ctx,format) do {\
@@ -1675,6 +1727,10 @@ struct _grn_obj_format {
1675
1727
  GRN_OBJ_FIN((ctx), &(format)->columns);\
1676
1728
  } while (0)
1677
1729
 
1730
+ GRN_API void grn_output_obj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
1731
+ grn_obj *obj, grn_obj_format *format);
1732
+
1733
+ /* obsolete */
1678
1734
  GRN_API grn_rc grn_text_otoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj,
1679
1735
  grn_obj_format *format);
1680
1736
 
@@ -1747,6 +1803,10 @@ GRN_API grn_rc grn_text_otoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj,
1747
1803
  #define GRN_PTR_INIT(obj,flags,domain)\
1748
1804
  GRN_OBJ_INIT((obj), ((flags) & GRN_OBJ_VECTOR) ? GRN_PVECTOR : GRN_PTR,\
1749
1805
  ((flags) & GRN_OBJ_DO_SHALLOW_COPY), (domain))
1806
+ #define GRN_TOKYO_GEO_POINT_INIT(obj,flags) \
1807
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_TOKYO_GEO_POINT)
1808
+ #define GRN_WGS84_GEO_POINT_INIT(obj,flags) \
1809
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_WGS84_GEO_POINT)
1750
1810
 
1751
1811
  #define GRN_BOOL_SET(ctx,obj,val) do {\
1752
1812
  unsigned char _val = (unsigned char)(val);\
@@ -1798,6 +1858,18 @@ GRN_API grn_rc grn_text_otoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj,
1798
1858
  grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_obj *));\
1799
1859
  } while (0)
1800
1860
 
1861
+ typedef struct {
1862
+ int latitude;
1863
+ int longitude;
1864
+ } grn_geo_point;
1865
+
1866
+ #define GRN_GEO_POINT_SET(ctx,obj,_latitude,_longitude) do {\
1867
+ grn_geo_point _val;\
1868
+ _val.latitude = (int)(_latitude);\
1869
+ _val.longitude = (int)(_longitude);\
1870
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_geo_point));\
1871
+ } while (0)
1872
+
1801
1873
  #define GRN_BOOL_SET_AT(ctx,obj,offset,val) do {\
1802
1874
  unsigned char _val = (unsigned char)(val);\
1803
1875
  grn_bulk_write_from((ctx), (obj), (char *)&_val,\
@@ -1885,6 +1957,11 @@ GRN_API void grn_time_now(grn_ctx *ctx, grn_obj *obj);
1885
1957
  #define GRN_TIME_VALUE GRN_INT64_VALUE
1886
1958
  #define GRN_RECORD_VALUE(obj) (*((grn_id *)GRN_BULK_HEAD(obj)))
1887
1959
  #define GRN_PTR_VALUE(obj) (*((grn_obj **)GRN_BULK_HEAD(obj)))
1960
+ #define GRN_GEO_POINT_VALUE(obj,_latitude,_longitude) do {\
1961
+ grn_geo_point *_val = (grn_geo_point *)GRN_BULK_HEAD(obj);\
1962
+ _latitude = _val->latitude;\
1963
+ _longitude = _val->longitude;\
1964
+ } while (0)
1888
1965
 
1889
1966
  #define GRN_BOOL_VALUE_AT(obj,offset) (((unsigned char *)GRN_BULK_HEAD(obj))[offset])
1890
1967
  #define GRN_INT8_VALUE_AT(obj,offset) (((signed char *)GRN_BULK_HEAD(obj))[offset])
@@ -1895,7 +1972,7 @@ GRN_API void grn_time_now(grn_ctx *ctx, grn_obj *obj);
1895
1972
  #define GRN_UINT32_VALUE_AT(obj,offset) (((unsigned int *)GRN_BULK_HEAD(obj))[offset])
1896
1973
  #define GRN_INT64_VALUE_AT(obj,offset) (((long long int *)GRN_BULK_HEAD(obj))[offset])
1897
1974
  #define GRN_UINT64_VALUE_AT(obj,offset) (((long long unsigned int *)GRN_BULK_HEAD(obj))[offset])
1898
- #define GRN_FLOAT_VALUE_AT(ob,offsetj) (((double *)GRN_BULK_HEAD(obj))[offset])
1975
+ #define GRN_FLOAT_VALUE_AT(obj,offset) (((double *)GRN_BULK_HEAD(obj))[offset])
1899
1976
  #define GRN_TIME_VALUE_AT GRN_INT64_VALUE_AT
1900
1977
  #define GRN_RECORD_VALUE_AT(obj,offset) (((grn_id *)GRN_BULK_HEAD(obj))[offset])
1901
1978
  #define GRN_PTR_VALUE_AT(obj,offset) (((grn_obj **)GRN_BULK_HEAD(obj))[offset])
@@ -1992,13 +2069,10 @@ GRN_API grn_obj *grn_expr_append_const_int(grn_ctx *ctx, grn_obj *expr, int i,
1992
2069
  GRN_API grn_rc grn_expr_append_op(grn_ctx *ctx, grn_obj *expr, grn_operator op, int nargs);
1993
2070
 
1994
2071
  GRN_API grn_rc grn_expr_compile(grn_ctx *ctx, grn_obj *expr);
1995
- GRN_API grn_rc grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs);
2072
+ GRN_API grn_obj *grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs);
1996
2073
  GRN_API grn_rc grn_ctx_push(grn_ctx *ctx, grn_obj *obj);
1997
2074
  GRN_API grn_obj *grn_ctx_pop(grn_ctx *ctx);
1998
2075
 
1999
- #define GRN_EXPR_CALL(ctx,expr,nargs) \
2000
- (grn_expr_exec((ctx), (expr), (nargs)), grn_ctx_pop(ctx))
2001
-
2002
2076
  GRN_API grn_obj *grn_expr_alloc(grn_ctx *ctx, grn_obj *expr,
2003
2077
  grn_id domain, grn_obj_flags flags);
2004
2078
 
@@ -2042,21 +2116,6 @@ GRN_API grn_table_sort_key *grn_table_sort_key_from_str(grn_ctx *ctx,
2042
2116
  GRN_API grn_rc grn_table_sort_key_close(grn_ctx *ctx,
2043
2117
  grn_table_sort_key *keys, unsigned nkeys);
2044
2118
 
2045
- GRN_API grn_rc grn_select(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
2046
- const char *table, unsigned table_len,
2047
- const char *match_columns, unsigned match_columns_len,
2048
- const char *query, unsigned query_len,
2049
- const char *filter, unsigned filter_len,
2050
- const char *scorer, unsigned scorer_len,
2051
- const char *sortby, unsigned sortby_len,
2052
- const char *output_columns, unsigned output_columns_len,
2053
- int offset, int hits,
2054
- const char *drilldown, unsigned drilldown_len,
2055
- const char *drilldown_sortby, unsigned drilldown_sortby_len,
2056
- const char *drilldown_output_columns,
2057
- unsigned drilldown_output_columns_len,
2058
- int drilldown_offset, int drilldown_hits);
2059
-
2060
2119
  GRN_API grn_rc grn_load(grn_ctx *ctx, grn_content_type input_type,
2061
2120
  const char *table, unsigned table_len,
2062
2121
  const char *columns, unsigned columns_len,
@@ -2085,6 +2144,8 @@ struct _grn_ctx_info {
2085
2144
  GRN_API grn_rc grn_ctx_info_get(grn_ctx *ctx, grn_ctx_info *info);
2086
2145
 
2087
2146
  GRN_API grn_rc grn_set_segv_handler(void);
2147
+ GRN_API grn_rc grn_set_int_handler(void);
2148
+ GRN_API grn_rc grn_set_term_handler(void);
2088
2149
 
2089
2150
  /* hash */
2090
2151
 
@@ -0,0 +1,41 @@
1
+ # cast.la - a libtool library file
2
+ # Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2
3
+ #
4
+ # Please DO NOT delete this file!
5
+ # It is necessary for linking the library.
6
+
7
+ # The name that we can dlopen(3).
8
+ dlname='cast.dll'
9
+
10
+ # Names of this library.
11
+ library_names='cast.dll.a'
12
+
13
+ # The name of the static archive.
14
+ old_library='cast.a'
15
+
16
+ # Linker flags that can not go in dependency_libs.
17
+ inherited_linker_flags=''
18
+
19
+ # Libraries that this one depends upon.
20
+ dependency_libs=' /tmp/local/lib/libgroonga.la -ladvapi32 -lws2_32'
21
+
22
+ # Names of additional weak libraries provided by this library
23
+ weak_library_names=''
24
+
25
+ # Version information for cast.
26
+ current=0
27
+ age=0
28
+ revision=0
29
+
30
+ # Is this an already installed library?
31
+ installed=yes
32
+
33
+ # Should we warn about portability when linking against -modules?
34
+ shouldnotlink=yes
35
+
36
+ # Files to dlopen/dlpreopen
37
+ dlopen=''
38
+ dlpreopen=''
39
+
40
+ # Directory that this library needs to be installed in:
41
+ libdir='/tmp/local/lib/groonga/modules/functions'