rroonga 1.2.6 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +30 -0
- data/Rakefile +1 -0
- data/ext/groonga/rb-grn-database.c +0 -1
- data/ext/groonga/rb-grn-snippet.c +44 -1
- data/ext/groonga/rb-grn-utils.c +1 -1
- data/ext/groonga/rb-grn.h +1 -1
- data/lib/groonga/dumper.rb +3 -3
- data/test/test-expression.rb +2 -0
- metadata +4 -3
data/Gemfile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- mode: ruby; coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2011 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
|
+
source "http://rubygems.org/"
|
19
|
+
|
20
|
+
gem 'pkg-config'
|
21
|
+
|
22
|
+
group :development, :test do
|
23
|
+
gem "test-unit"
|
24
|
+
gem "test-unit-notify"
|
25
|
+
gem "rake"
|
26
|
+
gem "rake-compiler"
|
27
|
+
gem "jeweler"
|
28
|
+
gem "yard"
|
29
|
+
gem "packnga"
|
30
|
+
end
|
data/Rakefile
CHANGED
@@ -66,7 +66,8 @@ rb_rb_grn_snippet_free (void *object)
|
|
66
66
|
{
|
67
67
|
RbGrnSnippet *rb_grn_snippet = object;
|
68
68
|
|
69
|
-
if (
|
69
|
+
if (!rb_grn_exited &&
|
70
|
+
rb_grn_snippet->owner &&
|
70
71
|
rb_grn_snippet->context && rb_grn_snippet->snippet)
|
71
72
|
grn_snip_close(rb_grn_snippet->context,
|
72
73
|
rb_grn_snippet->snippet);
|
@@ -237,6 +238,12 @@ rb_grn_snippet_add_keyword (int argc, VALUE *argv, VALUE self)
|
|
237
238
|
|
238
239
|
rb_grn_snippet = SELF(self);
|
239
240
|
|
241
|
+
if (!rb_grn_snippet->snippet) {
|
242
|
+
rb_raise(rb_eGrnClosed,
|
243
|
+
"can't access already closed groonga object: %s",
|
244
|
+
rb_grn_inspect(CLASS_OF(self)));
|
245
|
+
}
|
246
|
+
|
240
247
|
keyword = StringValuePtr(rb_keyword);
|
241
248
|
keyword_length = RSTRING_LEN(rb_keyword);
|
242
249
|
|
@@ -294,6 +301,12 @@ rb_grn_snippet_execute (VALUE self, VALUE rb_string)
|
|
294
301
|
context = rb_grn_snippet->context;
|
295
302
|
snippet = rb_grn_snippet->snippet;
|
296
303
|
|
304
|
+
if (!snippet) {
|
305
|
+
rb_raise(rb_eGrnClosed,
|
306
|
+
"can't access already closed groonga object: %s",
|
307
|
+
rb_grn_inspect(CLASS_OF(self)));
|
308
|
+
}
|
309
|
+
|
297
310
|
#ifdef HAVE_RUBY_ENCODING_H
|
298
311
|
rb_string = rb_grn_context_rb_string_encode(context, rb_string);
|
299
312
|
#endif
|
@@ -320,6 +333,34 @@ rb_grn_snippet_execute (VALUE self, VALUE rb_string)
|
|
320
333
|
return rb_results;
|
321
334
|
}
|
322
335
|
|
336
|
+
/*
|
337
|
+
* Document-method: close
|
338
|
+
*
|
339
|
+
* call-seq:
|
340
|
+
* snippet.close
|
341
|
+
*
|
342
|
+
* _snippet_が使用しているリソースを開放する。これ以降_snippet_を
|
343
|
+
* 使うことはできない。
|
344
|
+
*/
|
345
|
+
static VALUE
|
346
|
+
rb_grn_snippet_close (VALUE self)
|
347
|
+
{
|
348
|
+
RbGrnSnippet *rb_grn_snippet;
|
349
|
+
grn_ctx *context;
|
350
|
+
grn_snip *snippet;
|
351
|
+
|
352
|
+
rb_grn_snippet = SELF(self);
|
353
|
+
context = rb_grn_snippet->context;
|
354
|
+
snippet = rb_grn_snippet->snippet;
|
355
|
+
if (context && snippet) {
|
356
|
+
grn_snip_close(context, snippet);
|
357
|
+
rb_grn_snippet->context = NULL;
|
358
|
+
rb_grn_snippet->snippet = NULL;
|
359
|
+
}
|
360
|
+
|
361
|
+
return Qnil;
|
362
|
+
}
|
363
|
+
|
323
364
|
void
|
324
365
|
rb_grn_init_snippet (VALUE mGrn)
|
325
366
|
{
|
@@ -332,4 +373,6 @@ rb_grn_init_snippet (VALUE mGrn)
|
|
332
373
|
rb_grn_snippet_add_keyword, -1);
|
333
374
|
rb_define_method(rb_cGrnSnippet, "execute",
|
334
375
|
rb_grn_snippet_execute, 1);
|
376
|
+
rb_define_method(rb_cGrnSnippet, "close",
|
377
|
+
rb_grn_snippet_close, 0);
|
335
378
|
}
|
data/ext/groonga/rb-grn-utils.c
CHANGED
@@ -244,7 +244,7 @@ rb_grn_bulk_from_ruby_object (VALUE object, grn_ctx *context, grn_obj *bulk)
|
|
244
244
|
grn_obj_reinit(context, bulk, GRN_DB_VOID, 0);
|
245
245
|
break;
|
246
246
|
case T_SYMBOL:
|
247
|
-
object =
|
247
|
+
object = rb_funcall(object, rb_intern("to_s"), 0);
|
248
248
|
case T_STRING:
|
249
249
|
grn_obj_reinit(context, bulk, GRN_DB_TEXT, 0);
|
250
250
|
rb_grn_context_text_set(context, bulk, object);
|
data/ext/groonga/rb-grn.h
CHANGED
data/lib/groonga/dumper.rb
CHANGED
@@ -88,9 +88,9 @@ module Groonga
|
|
88
88
|
output = options[:output]
|
89
89
|
plugins_dir_re = Regexp.escape(Groonga::Plugin.system_plugins_dir)
|
90
90
|
suffix_re = Regexp.escape(Groonga::Plugin.suffix)
|
91
|
-
plugin_name = plugin.path.gsub
|
92
|
-
|
93
|
-
|
91
|
+
plugin_name = plugin.path.gsub(/(?:\A#{plugins_dir_re}\/|
|
92
|
+
#{suffix_re}\z)/x,
|
93
|
+
'')
|
94
94
|
output.write("register #{plugin_name}\n")
|
95
95
|
end
|
96
96
|
|
data/test/test-expression.rb
CHANGED
@@ -106,6 +106,7 @@ class ExpressionTest < Test::Unit::TestCase
|
|
106
106
|
"提供するプロジェクトです。groongaの機能を" +
|
107
107
|
"Rubyらしい読み書きしやすい構文で利用できる" +
|
108
108
|
"ことが利点です。"))
|
109
|
+
snippet.close
|
109
110
|
end
|
110
111
|
|
111
112
|
def test_snippet_without_tags
|
@@ -127,5 +128,6 @@ class ExpressionTest < Test::Unit::TestCase
|
|
127
128
|
snippet = expression.snippet([], :width => 30)
|
128
129
|
assert_equal(["ラングバプロジェクト"],
|
129
130
|
snippet.execute("ラングバプロジェクトはカラムストア機能も"))
|
131
|
+
snippet.close
|
130
132
|
end
|
131
133
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rroonga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 7
|
10
|
+
version: 1.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kouhei Sutou
|
@@ -149,6 +149,7 @@ extra_rdoc_files:
|
|
149
149
|
- README.textile
|
150
150
|
- TODO
|
151
151
|
files:
|
152
|
+
- Gemfile
|
152
153
|
- Rakefile
|
153
154
|
- benchmark/common.rb
|
154
155
|
- benchmark/create-wikipedia-database.rb
|