rroonga 1.0.4 → 1.0.5
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/NEWS.ja.rdoc +11 -0
- data/NEWS.rdoc +12 -1
- data/ext/groonga/rb-grn-object.c +2 -1
- data/ext/groonga/rb-grn.h +1 -1
- data/html/index.html +2 -3
- data/lib/groonga/schema.rb +56 -20
- data/test/test-schema-type.rb +167 -0
- data/text/tutorial.ja.rdoc +2 -2
- metadata +5 -4
data/NEWS.ja.rdoc
CHANGED
data/NEWS.rdoc
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
= NEWS
|
2
2
|
|
3
|
-
== 1.0.
|
3
|
+
== 1.0.5: 2010-11-29
|
4
|
+
|
5
|
+
=== Improvements
|
6
|
+
|
7
|
+
* Added snail_case type name aliases for built-in groonga types
|
8
|
+
to Groonga::Schema.
|
9
|
+
|
10
|
+
=== Fixes
|
11
|
+
|
12
|
+
* Fixed a crash bug on GC. [Ryo Onodera]
|
13
|
+
|
14
|
+
== 1.0.4: 2010-11-29
|
4
15
|
|
5
16
|
=== Improvements
|
6
17
|
|
data/ext/groonga/rb-grn-object.c
CHANGED
@@ -331,7 +331,6 @@ rb_grn_object_bind_common (VALUE klass, VALUE self, VALUE rb_context,
|
|
331
331
|
rb_grn_object->range = grn_ctx_at(context, rb_grn_object->range_id);
|
332
332
|
|
333
333
|
DATA_PTR(self) = rb_grn_object;
|
334
|
-
rb_iv_set(self, "@context", rb_context);
|
335
334
|
}
|
336
335
|
|
337
336
|
void
|
@@ -398,6 +397,8 @@ rb_grn_object_assign (VALUE klass, VALUE self, VALUE rb_context,
|
|
398
397
|
object->header.type);
|
399
398
|
}
|
400
399
|
|
400
|
+
rb_iv_set(self, "@context", rb_context);
|
401
|
+
|
401
402
|
debug("assign: %p:%p:%p 0x%x\n", context, object, rb_grn_object,
|
402
403
|
object->header.type);
|
403
404
|
}
|
data/ext/groonga/rb-grn.h
CHANGED
data/html/index.html
CHANGED
@@ -49,7 +49,7 @@
|
|
49
49
|
|
50
50
|
<h3>rroongaの最新リリース</h3>
|
51
51
|
<p>
|
52
|
-
2010-11-29にリリースされた1.0.
|
52
|
+
2010-11-29にリリースされた1.0.5が最新です。
|
53
53
|
</p>
|
54
54
|
|
55
55
|
<h3 id="install-rroonga">rroongaのインストール</h3>
|
@@ -78,7 +78,6 @@
|
|
78
78
|
ActiveGroongaは以下のようにActiveRecordのような機能を持っているため、こまでのRailsアプリケーションの知識を利用することができます。
|
79
79
|
<ul>
|
80
80
|
<li>マイグレーション</li>
|
81
|
-
<li>フィクスチャ</li>
|
82
81
|
<li>バリデーション</li>
|
83
82
|
<li>リレーション</li>
|
84
83
|
</ul>
|
@@ -86,7 +85,7 @@
|
|
86
85
|
|
87
86
|
<h3>ActiveGroongaの最新リリース</h3>
|
88
87
|
<p>
|
89
|
-
|
88
|
+
2010-11-29にリリースされた1.0.1が最新です。
|
90
89
|
</p>
|
91
90
|
|
92
91
|
<h3 id="install-active-groonga">ActiveGroongaのインストール</h3>
|
data/lib/groonga/schema.rb
CHANGED
@@ -418,30 +418,66 @@ module Groonga
|
|
418
418
|
end
|
419
419
|
end
|
420
420
|
|
421
|
+
NORMALIZE_TYPE_TABLE = {
|
422
|
+
"short_text" => "ShortText",
|
423
|
+
"string" => "ShortText",
|
424
|
+
"text" => "Text",
|
425
|
+
"binary" => "LongText",
|
426
|
+
"long_text" => "LongText",
|
427
|
+
"int" => "Int32",
|
428
|
+
"integer" => "Int32",
|
429
|
+
"int32" => "Int32",
|
430
|
+
"integer32" => "Int32",
|
431
|
+
"decimal" => "Int64",
|
432
|
+
"int64" => "Int64",
|
433
|
+
"integer64" => "Int64",
|
434
|
+
"uint" => "UInt32",
|
435
|
+
"unsigned_integer" => "UInt32",
|
436
|
+
"uint32" => "UInt32",
|
437
|
+
"unsigned_integer32" => "UInt32",
|
438
|
+
"uint64" => "UInt64",
|
439
|
+
"unsigned_integer64" => "UInt64",
|
440
|
+
"float" => "Float",
|
441
|
+
"datetime" => "Time",
|
442
|
+
"timestamp" => "Time",
|
443
|
+
"time" => "Time",
|
444
|
+
"date" => "Time",
|
445
|
+
"boolean" => "Bool",
|
446
|
+
"unigram" => "TokenUnigram",
|
447
|
+
"token_unigram" => "TokenUnigram",
|
448
|
+
"bigram" => "TokenBigram",
|
449
|
+
"token_bigram" => "TokenBigram",
|
450
|
+
"bigram_split_symbol" => "TokenBigramSplitSymbol",
|
451
|
+
"token_bigram_split_symbol" => "TokenBigramSplitSymbol",
|
452
|
+
"bigram_split_symbol_alpha" => "TokenBigramSplitSymbolAlpha",
|
453
|
+
"token_bigram_split_symbol_alpha" => "TokenBigramSplitSymbolAlpha",
|
454
|
+
"bigram_split_symbol_alpha_digit" => "TokenBigramSplitSymbolAlphaDigit",
|
455
|
+
"token_bigram_split_symbol_alpha_digit" =>
|
456
|
+
"TokenBigramSplitSymbolAlphaDigit",
|
457
|
+
"bigram_ignore_blank" => "TokenBigramIgnoreBlank",
|
458
|
+
"token_bigram_ignore_blank" => "TokenBigramIgnoreBlank",
|
459
|
+
"bigram_ignore_blank_split_symbol" =>
|
460
|
+
"TokenBigramIgnoreBlankSplitSymbol",
|
461
|
+
"token_bigram_ignore_blank_split_symbol" =>
|
462
|
+
"TokenBigramIgnoreBlankSplitSymbol",
|
463
|
+
"bigram_ignore_blank_split_symbol_alpha" =>
|
464
|
+
"TokenBigramIgnoreBlankSplitSymbolAlpha",
|
465
|
+
"token_bigram_ignore_blank_split_symbol_alpha" =>
|
466
|
+
"TokenBigramIgnoreBlankSplitSymbolAlpha",
|
467
|
+
"bigram_ignore_blank_split_symbol_alpha_digit" =>
|
468
|
+
"TokenBigramIgnoreBlankSplitSymbolAlphaDigit",
|
469
|
+
"token_bigram_ignore_blank_split_symbol_alpha_digit" =>
|
470
|
+
"TokenBigramIgnoreBlankSplitSymbolAlphaDigit",
|
471
|
+
"trigram" => "TokenTrigram",
|
472
|
+
"token_trigram" => "TokenTrigram",
|
473
|
+
"mecab" => "TokenMecab",
|
474
|
+
"token_mecab"=> "TokenMecab",
|
475
|
+
}
|
421
476
|
def normalize_type(type) # :nodoc:
|
422
477
|
return type if type.nil?
|
423
478
|
return type if type.is_a?(Groonga::Object)
|
424
479
|
type = type.to_s if type.is_a?(Symbol)
|
425
|
-
|
426
|
-
when "string"
|
427
|
-
"ShortText"
|
428
|
-
when "text"
|
429
|
-
"Text"
|
430
|
-
when "int", "integer"
|
431
|
-
"Int32"
|
432
|
-
when "float"
|
433
|
-
"Float"
|
434
|
-
when "decimal"
|
435
|
-
"Int64"
|
436
|
-
when "datetime", "timestamp", "time", "date"
|
437
|
-
"Time"
|
438
|
-
when "binary"
|
439
|
-
"LongText"
|
440
|
-
when "boolean"
|
441
|
-
"Bool"
|
442
|
-
else
|
443
|
-
type
|
444
|
-
end
|
480
|
+
NORMALIZE_TYPE_TABLE[type] || type
|
445
481
|
end
|
446
482
|
end
|
447
483
|
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# Copyright (C) 2010 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
class SchemaTypeTest < Test::Unit::TestCase
|
17
|
+
include GroongaTestUtils
|
18
|
+
|
19
|
+
def test_normalize_short_text
|
20
|
+
assert_normalize_type("ShortText", "short_text")
|
21
|
+
assert_normalize_type("ShortText", "string")
|
22
|
+
assert_normalize_type("ShortText", "ShortText")
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_normalize_text
|
26
|
+
assert_normalize_type("Text", "text")
|
27
|
+
assert_normalize_type("Text", "Text")
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_normalize_long_text
|
31
|
+
assert_normalize_type("LongText", "binary")
|
32
|
+
assert_normalize_type("LongText", "long_text")
|
33
|
+
assert_normalize_type("LongText", "LongText")
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_normalize_integer32
|
37
|
+
assert_normalize_type("Int32", "int")
|
38
|
+
assert_normalize_type("Int32", "integer")
|
39
|
+
assert_normalize_type("Int32", "int32")
|
40
|
+
assert_normalize_type("Int32", "integer32")
|
41
|
+
assert_normalize_type("Int32", "Int32")
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_normalize_integer64
|
45
|
+
assert_normalize_type("Int64", "int64")
|
46
|
+
assert_normalize_type("Int64", "integer64")
|
47
|
+
assert_normalize_type("Int64", "Int64")
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_normalize_unsigned_integer32
|
51
|
+
assert_normalize_type("UInt32", "uint")
|
52
|
+
assert_normalize_type("UInt32", "unsigned_integer")
|
53
|
+
assert_normalize_type("UInt32", "uint32")
|
54
|
+
assert_normalize_type("UInt32", "unsigned_integer32")
|
55
|
+
assert_normalize_type("UInt32", "UInt32")
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_normalize_unsigned_integer64
|
59
|
+
assert_normalize_type("UInt64", "uint64")
|
60
|
+
assert_normalize_type("UInt64", "unsigned_integer64")
|
61
|
+
assert_normalize_type("UInt64", "UInt64")
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_normalize_float
|
65
|
+
assert_normalize_type("Float", "float")
|
66
|
+
assert_normalize_type("Float", "Float")
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_normalize_time
|
70
|
+
assert_normalize_type("Time", "datetime")
|
71
|
+
assert_normalize_type("Time", "timestamp")
|
72
|
+
assert_normalize_type("Time", "time")
|
73
|
+
assert_normalize_type("Time", "date")
|
74
|
+
assert_normalize_type("Time", "Time")
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_normalize_boolean
|
78
|
+
assert_normalize_type("Bool", "boolean")
|
79
|
+
assert_normalize_type("Bool", "Bool")
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_normalize_unigram
|
83
|
+
assert_normalize_type("TokenUnigram", "unigram")
|
84
|
+
assert_normalize_type("TokenUnigram", "token_unigram")
|
85
|
+
assert_normalize_type("TokenUnigram", "TokenUnigram")
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_normalize_bigram
|
89
|
+
assert_normalize_type("TokenBigram", "bigram")
|
90
|
+
assert_normalize_type("TokenBigram", "token_bigram")
|
91
|
+
assert_normalize_type("TokenBigram", "TokenBigram")
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_normalize_bigram_split_symbol
|
95
|
+
assert_normalize_type("TokenBigramSplitSymbol", "bigram_split_symbol")
|
96
|
+
assert_normalize_type("TokenBigramSplitSymbol", "token_bigram_split_symbol")
|
97
|
+
assert_normalize_type("TokenBigramSplitSymbol", "TokenBigramSplitSymbol")
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_normalize_bigram_split_symbol_alpha
|
101
|
+
assert_normalize_type("TokenBigramSplitSymbolAlpha",
|
102
|
+
"bigram_split_symbol_alpha")
|
103
|
+
assert_normalize_type("TokenBigramSplitSymbolAlpha",
|
104
|
+
"token_bigram_split_symbol_alpha")
|
105
|
+
assert_normalize_type("TokenBigramSplitSymbolAlpha",
|
106
|
+
"TokenBigramSplitSymbolAlpha")
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_normalize_bigram_split_symbol_alpha_digit
|
110
|
+
assert_normalize_type("TokenBigramSplitSymbolAlphaDigit",
|
111
|
+
"bigram_split_symbol_alpha_digit")
|
112
|
+
assert_normalize_type("TokenBigramSplitSymbolAlphaDigit",
|
113
|
+
"token_bigram_split_symbol_alpha_digit")
|
114
|
+
assert_normalize_type("TokenBigramSplitSymbolAlphaDigit",
|
115
|
+
"TokenBigramSplitSymbolAlphaDigit")
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_normalize_bigram_ignore_blank
|
119
|
+
assert_normalize_type("TokenBigramIgnoreBlank", "bigram_ignore_blank")
|
120
|
+
assert_normalize_type("TokenBigramIgnoreBlank", "token_bigram_ignore_blank")
|
121
|
+
assert_normalize_type("TokenBigramIgnoreBlank", "TokenBigramIgnoreBlank")
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_normalize_bigram_ignore_blank_split_symbol
|
125
|
+
assert_normalize_type("TokenBigramIgnoreBlankSplitSymbol",
|
126
|
+
"bigram_ignore_blank_split_symbol")
|
127
|
+
assert_normalize_type("TokenBigramIgnoreBlankSplitSymbol",
|
128
|
+
"token_bigram_ignore_blank_split_symbol")
|
129
|
+
assert_normalize_type("TokenBigramIgnoreBlankSplitSymbol",
|
130
|
+
"TokenBigramIgnoreBlankSplitSymbol")
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_normalize_bigram_ignore_blank_split_symbol_alpha
|
134
|
+
assert_normalize_type("TokenBigramIgnoreBlankSplitSymbolAlpha",
|
135
|
+
"bigram_ignore_blank_split_symbol_alpha")
|
136
|
+
assert_normalize_type("TokenBigramIgnoreBlankSplitSymbolAlpha",
|
137
|
+
"token_bigram_ignore_blank_split_symbol_alpha")
|
138
|
+
assert_normalize_type("TokenBigramIgnoreBlankSplitSymbolAlpha",
|
139
|
+
"TokenBigramIgnoreBlankSplitSymbolAlpha")
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_normalize_bigram_ignore_blank_split_symbol_alpha_digit
|
143
|
+
assert_normalize_type("TokenBigramIgnoreBlankSplitSymbolAlphaDigit",
|
144
|
+
"bigram_ignore_blank_split_symbol_alpha_digit")
|
145
|
+
assert_normalize_type("TokenBigramIgnoreBlankSplitSymbolAlphaDigit",
|
146
|
+
"token_bigram_ignore_blank_split_symbol_alpha_digit")
|
147
|
+
assert_normalize_type("TokenBigramIgnoreBlankSplitSymbolAlphaDigit",
|
148
|
+
"TokenBigramIgnoreBlankSplitSymbolAlphaDigit")
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_normalize_trigram
|
152
|
+
assert_normalize_type("TokenTrigram", "trigram")
|
153
|
+
assert_normalize_type("TokenTrigram", "token_trigram")
|
154
|
+
assert_normalize_type("TokenTrigram", "TokenTrigram")
|
155
|
+
end
|
156
|
+
|
157
|
+
def test_normalize_mecab
|
158
|
+
assert_normalize_type("TokenMecab", "mecab")
|
159
|
+
assert_normalize_type("TokenMecab", "token_mecab")
|
160
|
+
assert_normalize_type("TokenMecab", "TokenMecab")
|
161
|
+
end
|
162
|
+
|
163
|
+
private
|
164
|
+
def assert_normalize_type(expected, type)
|
165
|
+
assert_equal(expected, Groonga::Schema.normalize_type(type))
|
166
|
+
end
|
167
|
+
end
|
data/text/tutorial.ja.rdoc
CHANGED
@@ -133,8 +133,8 @@ N-gramを利用した全文検索では、分解したN文字とその出現位
|
|
133
133
|
るかの文字数になります。groongaは1文字で分解するユニグラム、
|
134
134
|
2文字のバイグラム、3文字のトリグラムをサポートしています。
|
135
135
|
|
136
|
-
|
137
|
-
=> true</tt>も指定しています。
|
136
|
+
また、大文字小文字の区別なく検索するために
|
137
|
+
<tt>:key_normalize => true</tt>も指定しています。
|
138
138
|
|
139
139
|
単語格納用テーブルの準備ができたので、<tt>Items</tt>テーブ
|
140
140
|
ルの+title+カラムに対するインデックスを定義します。
|
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: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 5
|
10
|
+
version: 1.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kouhei Sutou
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2010-11-
|
22
|
+
date: 2010-11-29 00:00:00 +09:00
|
23
23
|
default_executable:
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
@@ -242,6 +242,7 @@ files:
|
|
242
242
|
- test/test-record.rb
|
243
243
|
- test/test-remote.rb
|
244
244
|
- test/test-schema-create-table.rb
|
245
|
+
- test/test-schema-type.rb
|
245
246
|
- test/test-schema-view.rb
|
246
247
|
- test/test-schema.rb
|
247
248
|
- test/test-snippet.rb
|