rroonga 1.2.0 → 1.2.1

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 (159) hide show
  1. data/README.textile +71 -0
  2. data/Rakefile +213 -128
  3. data/TODO +0 -0
  4. data/example/bookmark.rb +12 -12
  5. data/ext/groonga/Makefile +233 -0
  6. data/ext/groonga/extconf.rb +1 -1
  7. data/ext/groonga/rb-grn-column.c +5 -5
  8. data/ext/groonga/rb-grn-index-column.c +31 -0
  9. data/ext/groonga/rb-grn-index-cursor.c +106 -0
  10. data/ext/groonga/rb-grn-logger.c +5 -5
  11. data/ext/groonga/rb-grn-object.c +48 -0
  12. data/ext/groonga/rb-grn-patricia-trie.c +1 -1
  13. data/ext/groonga/rb-grn-plugin.c +32 -0
  14. data/ext/groonga/rb-grn-posting.c +51 -0
  15. data/ext/groonga/rb-grn-table-cursor.c +6 -1
  16. data/ext/groonga/rb-grn-table.c +31 -13
  17. data/ext/groonga/rb-grn.h +21 -3
  18. data/ext/groonga/rb-groonga.c +3 -1
  19. data/lib/groonga.rb +1 -0
  20. data/lib/groonga/dumper.rb +25 -5
  21. data/lib/groonga/expression-builder.rb +2 -2
  22. data/lib/groonga/pagination.rb +99 -7
  23. data/lib/groonga/posting.rb +87 -0
  24. data/lib/groonga/record.rb +118 -11
  25. data/lib/groonga/schema.rb +18 -1
  26. data/test/groonga-test-utils.rb +1 -6
  27. data/test/run-test.rb +13 -28
  28. data/test/test-column.rb +4 -0
  29. data/test/test-database-dumper.rb +53 -10
  30. data/test/test-hash.rb +6 -6
  31. data/test/test-index-cursor.rb +93 -0
  32. data/test/test-plugin.rb +6 -0
  33. data/test/test-record.rb +162 -1
  34. data/test/test-schema-type.rb +6 -0
  35. data/test/test-schema.rb +17 -0
  36. data/test/test-table.rb +7 -2
  37. data/test/test-type.rb +9 -1
  38. metadata +135 -245
  39. data/AUTHORS +0 -5
  40. data/NEWS.ja.rdoc +0 -344
  41. data/NEWS.rdoc +0 -346
  42. data/README.ja.rdoc +0 -68
  43. data/README.rdoc +0 -68
  44. data/example/search/config.ru +0 -230
  45. data/example/search/public/css/groonga.css +0 -122
  46. data/ext/.gitignore +0 -2
  47. data/html/bar.svg +0 -153
  48. data/html/developer.html +0 -151
  49. data/html/developer.svg +0 -469
  50. data/html/download.svg +0 -253
  51. data/html/favicon.ico +0 -0
  52. data/html/favicon.svg +0 -591
  53. data/html/footer.html.erb +0 -33
  54. data/html/head.html.erb +0 -4
  55. data/html/header.html.erb +0 -17
  56. data/html/heading-mark.svg +0 -393
  57. data/html/index.html +0 -243
  58. data/html/install.svg +0 -636
  59. data/html/logo.svg +0 -612
  60. data/html/ranguba.css +0 -342
  61. data/html/readme.svg +0 -256
  62. data/html/tutorial.svg +0 -559
  63. data/license/LGPL +0 -504
  64. data/test-unit-notify/Rakefile +0 -47
  65. data/test-unit-notify/lib/test/unit/notify.rb +0 -104
  66. data/test-unit/COPYING +0 -56
  67. data/test-unit/GPL +0 -340
  68. data/test-unit/PSFL +0 -271
  69. data/test-unit/Rakefile +0 -53
  70. data/test-unit/TODO +0 -5
  71. data/test-unit/bin/testrb +0 -5
  72. data/test-unit/html/bar.svg +0 -153
  73. data/test-unit/html/developer.svg +0 -469
  74. data/test-unit/html/favicon.ico +0 -0
  75. data/test-unit/html/favicon.svg +0 -82
  76. data/test-unit/html/heading-mark.svg +0 -393
  77. data/test-unit/html/index.html +0 -247
  78. data/test-unit/html/index.html.ja +0 -270
  79. data/test-unit/html/install.svg +0 -636
  80. data/test-unit/html/logo.svg +0 -483
  81. data/test-unit/html/test-unit.css +0 -339
  82. data/test-unit/html/tutorial.svg +0 -559
  83. data/test-unit/lib/test/unit.rb +0 -328
  84. data/test-unit/lib/test/unit/assertionfailederror.rb +0 -25
  85. data/test-unit/lib/test/unit/assertions.rb +0 -1334
  86. data/test-unit/lib/test/unit/attribute.rb +0 -125
  87. data/test-unit/lib/test/unit/autorunner.rb +0 -363
  88. data/test-unit/lib/test/unit/collector.rb +0 -36
  89. data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
  90. data/test-unit/lib/test/unit/collector/dir.rb +0 -108
  91. data/test-unit/lib/test/unit/collector/load.rb +0 -144
  92. data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
  93. data/test-unit/lib/test/unit/color-scheme.rb +0 -106
  94. data/test-unit/lib/test/unit/color.rb +0 -96
  95. data/test-unit/lib/test/unit/diff.rb +0 -740
  96. data/test-unit/lib/test/unit/error.rb +0 -130
  97. data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
  98. data/test-unit/lib/test/unit/failure.rb +0 -136
  99. data/test-unit/lib/test/unit/fixture.rb +0 -176
  100. data/test-unit/lib/test/unit/notification.rb +0 -129
  101. data/test-unit/lib/test/unit/omission.rb +0 -191
  102. data/test-unit/lib/test/unit/pending.rb +0 -150
  103. data/test-unit/lib/test/unit/priority.rb +0 -180
  104. data/test-unit/lib/test/unit/runner/console.rb +0 -52
  105. data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
  106. data/test-unit/lib/test/unit/runner/tap.rb +0 -8
  107. data/test-unit/lib/test/unit/testcase.rb +0 -483
  108. data/test-unit/lib/test/unit/testresult.rb +0 -121
  109. data/test-unit/lib/test/unit/testsuite.rb +0 -110
  110. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
  111. data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -430
  112. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -63
  113. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -82
  114. data/test-unit/lib/test/unit/ui/testrunner.rb +0 -53
  115. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
  116. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
  117. data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -42
  118. data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
  119. data/test-unit/lib/test/unit/util/observable.rb +0 -90
  120. data/test-unit/lib/test/unit/util/output.rb +0 -31
  121. data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
  122. data/test-unit/lib/test/unit/version.rb +0 -7
  123. data/test-unit/sample/adder.rb +0 -13
  124. data/test-unit/sample/subtracter.rb +0 -12
  125. data/test-unit/sample/test_adder.rb +0 -20
  126. data/test-unit/sample/test_subtracter.rb +0 -20
  127. data/test-unit/sample/test_user.rb +0 -23
  128. data/test-unit/test/collector/test-descendant.rb +0 -133
  129. data/test-unit/test/collector/test-load.rb +0 -442
  130. data/test-unit/test/collector/test_dir.rb +0 -406
  131. data/test-unit/test/collector/test_objectspace.rb +0 -100
  132. data/test-unit/test/run-test.rb +0 -15
  133. data/test-unit/test/test-attribute.rb +0 -86
  134. data/test-unit/test/test-color-scheme.rb +0 -69
  135. data/test-unit/test/test-color.rb +0 -47
  136. data/test-unit/test/test-diff.rb +0 -518
  137. data/test-unit/test/test-emacs-runner.rb +0 -60
  138. data/test-unit/test/test-fixture.rb +0 -287
  139. data/test-unit/test/test-notification.rb +0 -33
  140. data/test-unit/test/test-omission.rb +0 -81
  141. data/test-unit/test/test-pending.rb +0 -70
  142. data/test-unit/test/test-priority.rb +0 -119
  143. data/test-unit/test/test-testcase.rb +0 -544
  144. data/test-unit/test/test_assertions.rb +0 -1197
  145. data/test-unit/test/test_error.rb +0 -26
  146. data/test-unit/test/test_failure.rb +0 -33
  147. data/test-unit/test/test_testresult.rb +0 -113
  148. data/test-unit/test/test_testsuite.rb +0 -129
  149. data/test-unit/test/testunit-test-util.rb +0 -14
  150. data/test-unit/test/ui/test_tap.rb +0 -33
  151. data/test-unit/test/ui/test_testrunmediator.rb +0 -20
  152. data/test-unit/test/util/test-method-owner-finder.rb +0 -38
  153. data/test-unit/test/util/test-output.rb +0 -11
  154. data/test-unit/test/util/test_backtracefilter.rb +0 -41
  155. data/test-unit/test/util/test_observable.rb +0 -102
  156. data/test-unit/test/util/test_procwrapper.rb +0 -36
  157. data/test/.gitignore +0 -1
  158. data/text/expression.rdoc +0 -285
  159. data/text/tutorial.ja.rdoc +0 -433
data/TODO ADDED
File without changes
@@ -124,23 +124,23 @@ p(records = comments.select do |record|
124
124
  end)
125
125
 
126
126
  records.each do |record|
127
- record = record.key
128
- p [record.id,
129
- record.issued,
130
- record.item.title,
131
- record.author.name,
132
- record.content]
127
+ comment = record.key
128
+ p [comment.id,
129
+ comment.issued,
130
+ comment.item.title,
131
+ comment.author.name,
132
+ comment.content]
133
133
  end
134
134
 
135
135
  p records
136
136
 
137
137
  records.sort([{:key => "issued", :order => "descending"}]).each do |record|
138
- record = record.key
139
- p [record.id,
140
- record.issued,
141
- record.item.title,
142
- record.author.name,
143
- record.content]
138
+ comment = record.key
139
+ p [comment.id,
140
+ comment.issued,
141
+ comment.item.title,
142
+ comment.author.name,
143
+ comment.content]
144
144
  end
145
145
 
146
146
  records.group("item").each do |record|
@@ -0,0 +1,233 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = /home/yue/work/rroonga/ext/groonga
7
+ topdir = /usr/include/ruby-1.9.1
8
+ hdrdir = /usr/include/ruby-1.9.1
9
+ arch_hdrdir = /usr/include/ruby-1.9.1/$(arch)
10
+ VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
11
+ prefix = $(DESTDIR)/usr
12
+ rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
13
+ exec_prefix = $(prefix)
14
+ vendorhdrdir = $(rubyhdrdir)/vendor_ruby
15
+ sitehdrdir = $(rubyhdrdir)/site_ruby
16
+ rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
17
+ vendordir = $(DESTDIR)/usr/lib/ruby/vendor_ruby
18
+ sitedir = $(DESTDIR)/usr/local/lib/site_ruby
19
+ ridir = $(datarootdir)/$(RI_BASE_NAME)
20
+ mandir = $(prefix)/share/man
21
+ localedir = $(datarootdir)/locale
22
+ libdir = $(exec_prefix)/lib
23
+ psdir = $(docdir)
24
+ pdfdir = $(docdir)
25
+ dvidir = $(docdir)
26
+ htmldir = $(docdir)
27
+ infodir = $(prefix)/share/info
28
+ docdir = $(datarootdir)/doc/$(PACKAGE)
29
+ oldincludedir = $(DESTDIR)/usr/include
30
+ includedir = $(prefix)/include
31
+ localstatedir = $(DESTDIR)/var
32
+ sharedstatedir = $(prefix)/com
33
+ sysconfdir = $(DESTDIR)/etc
34
+ datadir = $(datarootdir)
35
+ datarootdir = $(prefix)/share
36
+ libexecdir = $(prefix)/lib/ruby1.9.1
37
+ sbindir = $(exec_prefix)/sbin
38
+ bindir = $(exec_prefix)/bin
39
+ rubylibdir = $(rubylibprefix)/$(ruby_version)
40
+ archdir = $(rubylibdir)/$(arch)
41
+ sitelibdir = $(sitedir)/$(ruby_version)
42
+ sitearchdir = $(sitelibdir)/$(sitearch)
43
+ vendorlibdir = $(vendordir)/$(ruby_version)
44
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
45
+
46
+ CC = gcc
47
+ CXX = g++
48
+ LIBRUBY = $(LIBRUBY_SO)
49
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
50
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
51
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
52
+ OUTFLAG = -o
53
+ COUTFLAG = -o
54
+
55
+ RUBY_EXTCONF_H =
56
+ cflags = $(optflags) $(debugflags) $(warnflags)
57
+ optflags = -O0
58
+ debugflags = -ggdb3
59
+ warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long
60
+ CFLAGS = -fPIC -fno-strict-aliasing -ggdb3 -O0 -fPIC -Wall -I/tmp/local/include/groonga
61
+ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
62
+ DEFS =
63
+ CPPFLAGS = -DRB_GRN_COMPILATION -DGRN_MAJOR_VERSION=1 -DGRN_MINOR_VERSION=2 -DGRN_MICRO_VERSION=1 -DHAVE_RB_ERRINFO -DHAVE_TYPE_ENUM_RUBY_VALUE_TYPE $(DEFS) $(cppflags)
64
+ CXXFLAGS = $(CFLAGS) -fno-strict-aliasing -g
65
+ ldflags = -L. -rdynamic -Wl,-export-dynamic -L/tmp/local/lib
66
+ dldflags =
67
+ ARCH_FLAG =
68
+ DLDFLAGS = $(ldflags) $(dldflags)
69
+ LDSHARED = $(CC) -shared
70
+ LDSHAREDXX = $(CXX) -shared
71
+ AR = ar
72
+ EXEEXT =
73
+
74
+ RUBY_BASE_NAME = ruby
75
+ RUBY_INSTALL_NAME = ruby1.9.1
76
+ RUBY_SO_NAME = ruby-1.9.1
77
+ arch = x86_64-linux
78
+ sitearch = $(arch)
79
+ ruby_version = 1.9.1
80
+ ruby = /usr/bin/ruby1.9.1
81
+ RUBY = $(ruby)
82
+ RM = rm -f
83
+ RM_RF = $(RUBY) -run -e rm -- -rf
84
+ RMDIRS = $(RUBY) -run -e rmdir -- -p
85
+ MAKEDIRS = /bin/mkdir -p
86
+ INSTALL = /usr/bin/install -c
87
+ INSTALL_PROG = $(INSTALL) -m 0755
88
+ INSTALL_DATA = $(INSTALL) -m 644
89
+ COPY = cp
90
+
91
+ #### End of system configuration section. ####
92
+
93
+ preload =
94
+
95
+ libpath = . $(libdir)
96
+ LIBPATH = -L. -L$(libdir)
97
+ DEFFILE =
98
+
99
+ CLEANFILES = mkmf.log
100
+ DISTCLEANFILES =
101
+ DISTCLEANDIRS =
102
+
103
+ extout =
104
+ extout_prefix =
105
+ target_prefix =
106
+ LOCAL_LIBS =
107
+ LIBS = $(LIBRUBYARG_SHARED) -lgroonga -lpthread -lrt -ldl -lcrypt -lm -lc
108
+ SRCS = rb-grn-snippet.c rb-grn-view.c rb-grn-query.c rb-grn-encoding-support.c rb-grn-record.c rb-grn-utils.c rb-grn-index-column.c rb-grn-index-cursor.c rb-grn-view-accessor.c rb-grn-object.c rb-grn-patricia-trie.c rb-grn-expression-builder.c rb-grn-variable.c rb-grn-hash-cursor.c rb-grn-fix-size-column.c rb-grn-variable-size-column.c rb-grn-table-key-support.c rb-grn-table.c rb-groonga.c rb-grn-table-cursor.c rb-grn-hash.c rb-grn-exception.c rb-grn-logger.c rb-grn-plugin.c rb-grn-encoding.c rb-grn-view-record.c rb-grn-view-cursor.c rb-grn-column.c rb-grn-procedure.c rb-grn-posting.c rb-grn-accessor.c rb-grn-operator.c rb-grn-type.c rb-grn-array.c rb-grn-patricia-trie-cursor.c rb-grn-context.c rb-grn-database.c rb-grn-array-cursor.c rb-grn-expression.c rb-grn-table-cursor-key-support.c
109
+ OBJS = rb-grn-snippet.o rb-grn-view.o rb-grn-query.o rb-grn-encoding-support.o rb-grn-record.o rb-grn-utils.o rb-grn-index-column.o rb-grn-index-cursor.o rb-grn-view-accessor.o rb-grn-object.o rb-grn-patricia-trie.o rb-grn-expression-builder.o rb-grn-variable.o rb-grn-hash-cursor.o rb-grn-fix-size-column.o rb-grn-variable-size-column.o rb-grn-table-key-support.o rb-grn-table.o rb-groonga.o rb-grn-table-cursor.o rb-grn-hash.o rb-grn-exception.o rb-grn-logger.o rb-grn-plugin.o rb-grn-encoding.o rb-grn-view-record.o rb-grn-view-cursor.o rb-grn-column.o rb-grn-procedure.o rb-grn-posting.o rb-grn-accessor.o rb-grn-operator.o rb-grn-type.o rb-grn-array.o rb-grn-patricia-trie-cursor.o rb-grn-context.o rb-grn-database.o rb-grn-array-cursor.o rb-grn-expression.o rb-grn-table-cursor-key-support.o
110
+ TARGET = groonga
111
+ DLLIB = $(TARGET).so
112
+ EXTSTATIC =
113
+ STATIC_LIB =
114
+
115
+ BINDIR = $(bindir)
116
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
117
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
118
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
119
+ HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
120
+ ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
121
+
122
+ TARGET_SO = $(DLLIB)
123
+ CLEANLIBS = $(TARGET).so
124
+ CLEANOBJS = *.o *.bak
125
+
126
+ all: $(DLLIB)
127
+ static: $(STATIC_LIB)
128
+ .PHONY: all install static install-so install-rb
129
+ .PHONY: clean clean-so clean-rb
130
+
131
+ clean-rb-default::
132
+ clean-rb::
133
+ clean-so::
134
+ clean: clean-so clean-rb-default clean-rb
135
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
136
+
137
+ distclean-rb-default::
138
+ distclean-rb::
139
+ distclean-so::
140
+ distclean: clean distclean-so distclean-rb-default distclean-rb
141
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
142
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
143
+ @-$(RMDIRS) $(DISTCLEANDIRS)
144
+
145
+ realclean: distclean
146
+ install: install-so install-rb
147
+
148
+ install-so: $(RUBYARCHDIR)
149
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
150
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
151
+ @-$(MAKEDIRS) $(@D)
152
+ $(INSTALL_PROG) $(DLLIB) $(@D)
153
+ install-rb: pre-install-rb install-rb-default
154
+ install-rb-default: pre-install-rb-default
155
+ pre-install-rb: Makefile
156
+ pre-install-rb-default: Makefile
157
+ pre-install-rb: $(RUBYLIBDIR)
158
+ install-rb: $(RUBYLIBDIR)/groonga.rb
159
+ $(RUBYLIBDIR)/groonga.rb: $(srcdir)/../../lib/groonga.rb
160
+ @-$(MAKEDIRS) $(@D)
161
+ $(INSTALL_DATA) $(srcdir)/../../lib/groonga.rb $(@D)
162
+ pre-install-rb: $(RUBYLIBDIR)/groonga
163
+ install-rb: $(RUBYLIBDIR)/groonga/dumper.rb
164
+ $(RUBYLIBDIR)/groonga/dumper.rb: $(srcdir)/../../lib/groonga/dumper.rb
165
+ @-$(MAKEDIRS) $(@D)
166
+ $(INSTALL_DATA) $(srcdir)/../../lib/groonga/dumper.rb $(@D)
167
+ install-rb: $(RUBYLIBDIR)/groonga/pagination.rb
168
+ $(RUBYLIBDIR)/groonga/pagination.rb: $(srcdir)/../../lib/groonga/pagination.rb
169
+ @-$(MAKEDIRS) $(@D)
170
+ $(INSTALL_DATA) $(srcdir)/../../lib/groonga/pagination.rb $(@D)
171
+ install-rb: $(RUBYLIBDIR)/groonga/schema.rb
172
+ $(RUBYLIBDIR)/groonga/schema.rb: $(srcdir)/../../lib/groonga/schema.rb
173
+ @-$(MAKEDIRS) $(@D)
174
+ $(INSTALL_DATA) $(srcdir)/../../lib/groonga/schema.rb $(@D)
175
+ install-rb: $(RUBYLIBDIR)/groonga/expression-builder.rb
176
+ $(RUBYLIBDIR)/groonga/expression-builder.rb: $(srcdir)/../../lib/groonga/expression-builder.rb
177
+ @-$(MAKEDIRS) $(@D)
178
+ $(INSTALL_DATA) $(srcdir)/../../lib/groonga/expression-builder.rb $(@D)
179
+ install-rb: $(RUBYLIBDIR)/groonga/patricia-trie.rb
180
+ $(RUBYLIBDIR)/groonga/patricia-trie.rb: $(srcdir)/../../lib/groonga/patricia-trie.rb
181
+ @-$(MAKEDIRS) $(@D)
182
+ $(INSTALL_DATA) $(srcdir)/../../lib/groonga/patricia-trie.rb $(@D)
183
+ install-rb: $(RUBYLIBDIR)/groonga/view-record.rb
184
+ $(RUBYLIBDIR)/groonga/view-record.rb: $(srcdir)/../../lib/groonga/view-record.rb
185
+ @-$(MAKEDIRS) $(@D)
186
+ $(INSTALL_DATA) $(srcdir)/../../lib/groonga/view-record.rb $(@D)
187
+ install-rb: $(RUBYLIBDIR)/groonga/context.rb
188
+ $(RUBYLIBDIR)/groonga/context.rb: $(srcdir)/../../lib/groonga/context.rb
189
+ @-$(MAKEDIRS) $(@D)
190
+ $(INSTALL_DATA) $(srcdir)/../../lib/groonga/context.rb $(@D)
191
+ install-rb: $(RUBYLIBDIR)/groonga/record.rb
192
+ $(RUBYLIBDIR)/groonga/record.rb: $(srcdir)/../../lib/groonga/record.rb
193
+ @-$(MAKEDIRS) $(@D)
194
+ $(INSTALL_DATA) $(srcdir)/../../lib/groonga/record.rb $(@D)
195
+ install-rb: $(RUBYLIBDIR)/groonga/posting.rb
196
+ $(RUBYLIBDIR)/groonga/posting.rb: $(srcdir)/../../lib/groonga/posting.rb
197
+ @-$(MAKEDIRS) $(@D)
198
+ $(INSTALL_DATA) $(srcdir)/../../lib/groonga/posting.rb $(@D)
199
+ $(RUBYARCHDIR):
200
+ $(MAKEDIRS) $@
201
+ $(RUBYLIBDIR):
202
+ $(MAKEDIRS) $@
203
+ $(RUBYLIBDIR)/groonga:
204
+ $(MAKEDIRS) $@
205
+
206
+ site-install: site-install-so site-install-rb
207
+ site-install-so: install-so
208
+ site-install-rb: install-rb
209
+
210
+ .SUFFIXES: .c .m .cc .cxx .cpp .C .o
211
+
212
+ .cc.o:
213
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
214
+
215
+ .cxx.o:
216
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
217
+
218
+ .cpp.o:
219
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
220
+
221
+ .C.o:
222
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
223
+
224
+ .c.o:
225
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
226
+
227
+ $(DLLIB): $(OBJS) Makefile
228
+ @-$(RM) $(@)
229
+ $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
230
+
231
+
232
+
233
+ $(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
@@ -47,7 +47,7 @@ checking_for(checking_message("GCC")) do
47
47
  end
48
48
 
49
49
  checking_for(checking_message("Win32 OS")) do
50
- win32 = /cygwin|mingw|mswin32/ =~ RUBY_PLATFORM
50
+ win32 = /cygwin|mingw|mswin/ =~ RUBY_PLATFORM
51
51
  if win32
52
52
  $defs << "-DRB_GRN_PLATFORM_WIN32"
53
53
  import_library_name = "libruby-#{module_name}.a"
@@ -561,7 +561,7 @@ rb_grn_column_is_locked (int argc, VALUE *argv, VALUE self)
561
561
  * _column_の値がテーブルのレコードとなる場合は+true+を返し、
562
562
  * そうでない場合は+false+を返す。
563
563
  *
564
- * @since: 1.0.5
564
+ * @since 1.0.5
565
565
  */
566
566
  static VALUE
567
567
  rb_grn_column_reference_p (VALUE self)
@@ -599,7 +599,7 @@ rb_grn_column_reference_p (VALUE self)
599
599
  * _column_がGroonga::IndexColumnの場合は+true+を返し、
600
600
  * そうでない場合は+false+を返す。
601
601
  *
602
- * @since: 1.0.5
602
+ * @since 1.0.5
603
603
  */
604
604
  static VALUE
605
605
  rb_grn_column_index_p (VALUE self)
@@ -627,7 +627,7 @@ rb_grn_column_index_p (VALUE self)
627
627
  * _column_がベクターカラムの場合は+true+を返し、
628
628
  * そうでない場合は+false+を返す。
629
629
  *
630
- * @since: 1.0.5
630
+ * @since 1.0.5
631
631
  */
632
632
  static VALUE
633
633
  rb_grn_column_vector_p (VALUE self)
@@ -657,7 +657,7 @@ rb_grn_column_vector_p (VALUE self)
657
657
  * _column_がスカラーカラムの場合は+true+を返し、
658
658
  * そうでない場合は+false+を返す。
659
659
  *
660
- * @since: 1.0.5
660
+ * @since 1.0.5
661
661
  */
662
662
  static VALUE
663
663
  rb_grn_column_scalar_p (VALUE self)
@@ -692,7 +692,7 @@ rb_grn_column_scalar_p (VALUE self)
692
692
  *
693
693
  * _operation_を実行できる_column_のインデックスを返す。
694
694
  *
695
- * @since: 1.0.9
695
+ * @since 1.0.9
696
696
  */
697
697
  static VALUE
698
698
  rb_grn_column_get_indexes (int argc, VALUE *argv, VALUE self)
@@ -546,6 +546,35 @@ rb_grn_index_column_with_position_p (VALUE self)
546
546
  return CBOOL2RVAL(column->header.flags & GRN_OBJ_WITH_POSITION);
547
547
  }
548
548
 
549
+ static VALUE
550
+ rb_grn_index_column_open_cursor (VALUE self, VALUE rb_table_cursor)
551
+ {
552
+ grn_ctx *context;
553
+ grn_obj *column;
554
+ grn_table_cursor *table_cursor;
555
+ grn_id rid_min = GRN_ID_NIL;
556
+ grn_id rid_max = GRN_ID_MAX;
557
+ int flags = 0;
558
+ grn_obj *index_cursor;
559
+ VALUE rb_cursor;
560
+
561
+ rb_grn_index_column_deconstruct(SELF(self), &column, &context,
562
+ NULL, NULL,
563
+ NULL, NULL, NULL, NULL,
564
+ NULL, NULL);
565
+ table_cursor = RVAL2GRNTABLECURSOR(rb_table_cursor, NULL);
566
+
567
+ index_cursor = grn_index_cursor_open(context, table_cursor,
568
+ column, rid_min, rid_max, flags);
569
+
570
+ rb_cursor = GRNINDEXCURSOR2RVAL(context, index_cursor);
571
+
572
+ if (rb_block_given_p())
573
+ return rb_ensure(rb_yield, rb_cursor, rb_grn_object_close, rb_cursor);
574
+ else
575
+ return rb_cursor;
576
+ }
577
+
549
578
  void
550
579
  rb_grn_init_index_column (VALUE mGrn)
551
580
  {
@@ -571,4 +600,6 @@ rb_grn_init_index_column (VALUE mGrn)
571
600
  rb_grn_index_column_with_weight_p, 0);
572
601
  rb_define_method(rb_cGrnIndexColumn, "with_position?",
573
602
  rb_grn_index_column_with_position_p, 0);
603
+ rb_define_method(rb_cGrnIndexColumn, "open_cursor",
604
+ rb_grn_index_column_open_cursor, 1);
574
605
  }
@@ -0,0 +1,106 @@
1
+ /* -*- c-file-style: "ruby" -*- */
2
+ /*
3
+ Copyright (C) 2011 Haruka Yoshihara <yoshihara@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
+
19
+ #include "rb-grn.h"
20
+
21
+ #define SELF(object) ((RbGrnIndexCursor *)DATA_PTR(object))
22
+
23
+ VALUE rb_cGrnIndexCursor;
24
+
25
+ VALUE
26
+ rb_grn_index_cursor_to_ruby_object (grn_ctx *context,
27
+ grn_obj *cursor,
28
+ grn_bool owner)
29
+ {
30
+ return GRNOBJECT2RVAL(rb_cGrnIndexCursor, context, cursor, owner);
31
+ }
32
+
33
+ void
34
+ rb_grn_index_cursor_deconstruct (RbGrnIndexCursor *rb_grn_index_cursor,
35
+ grn_obj **cursor,
36
+ grn_ctx **context,
37
+ grn_id *domain_id,
38
+ grn_obj **domain,
39
+ grn_id *range_id,
40
+ grn_obj **range)
41
+ {
42
+ RbGrnObject *rb_grn_object;
43
+
44
+ rb_grn_object = RB_GRN_OBJECT(rb_grn_index_cursor);
45
+ rb_grn_object_deconstruct(rb_grn_object, cursor, context,
46
+ domain_id, domain,
47
+ range_id, range);
48
+ }
49
+
50
+ static VALUE
51
+ rb_grn_index_cursor_next (VALUE self)
52
+ {
53
+ VALUE rb_posting = Qnil;
54
+ grn_obj *cursor;
55
+ grn_ctx *context;
56
+
57
+ rb_grn_index_cursor_deconstruct(SELF(self), &cursor, &context,
58
+ NULL, NULL, NULL, NULL);
59
+
60
+ if (context && cursor) {
61
+ grn_posting *posting;
62
+ grn_id tid;
63
+
64
+ posting = grn_index_cursor_next(context, cursor, &tid);
65
+
66
+ if (posting) {
67
+ rb_posting = rb_grn_posting_new(posting, tid);
68
+ }
69
+ }
70
+
71
+ return rb_posting;
72
+
73
+ }
74
+
75
+ static VALUE
76
+ rb_grn_index_cursor_each (VALUE self)
77
+ {
78
+ grn_obj *cursor;
79
+ grn_ctx *context;
80
+
81
+ rb_grn_index_cursor_deconstruct(SELF(self), &cursor, &context,
82
+ NULL, NULL, NULL, NULL);
83
+
84
+ if (context && cursor) {
85
+ grn_posting *posting;
86
+ grn_id tid;
87
+
88
+ while ((posting = grn_index_cursor_next(context, cursor, &tid))) {
89
+ rb_yield(rb_grn_posting_new(posting, tid));
90
+ }
91
+ }
92
+
93
+ return Qnil;
94
+ }
95
+
96
+ void
97
+ rb_grn_init_index_cursor (VALUE mGrn)
98
+ {
99
+ rb_cGrnIndexCursor =
100
+ rb_define_class_under(mGrn, "IndexCursor", rb_cGrnObject);
101
+ rb_define_alloc_func(rb_cGrnIndexCursor, rb_grn_object_alloc);
102
+ rb_include_module(rb_cGrnIndexCursor, rb_mEnumerable);
103
+
104
+ rb_define_method(rb_cGrnIndexCursor, "next", rb_grn_index_cursor_next, 0);
105
+ rb_define_method(rb_cGrnIndexCursor, "each", rb_grn_index_cursor_each, 0);
106
+ }