Kouhei Sutou
null+****@clear*****
Thu Nov 6 15:45:47 JST 2014
Kouhei Sutou 2014-11-06 15:45:47 +0900 (Thu, 06 Nov 2014) New Revision: 03246877705acee56b94c18a6a09caaf017ad219 https://github.com/ranguba/rroonga/commit/03246877705acee56b94c18a6a09caaf017ad219 Message: Support token filters in inspect Modified files: ext/groonga/rb-grn-table-key-support.c test/test-hash.rb test/test-schema.rb Modified: ext/groonga/rb-grn-table-key-support.c (+23 -0) =================================================================== --- ext/groonga/rb-grn-table-key-support.c 2014-11-06 15:36:36 +0900 (0eb5e3b) +++ ext/groonga/rb-grn-table-key-support.c 2014-11-06 15:45:47 +0900 (505d312) @@ -145,6 +145,29 @@ rb_grn_table_key_support_inspect_content (VALUE self, VALUE inspected) } { + int i, n; + grn_obj token_filters; + + rb_str_cat2(inspected, ", "); + rb_str_cat2(inspected, "token_filters: ["); + + GRN_PTR_INIT(&token_filters, GRN_OBJ_VECTOR, GRN_ID_NIL); + grn_obj_get_info(context, table, + GRN_INFO_TOKEN_FILTERS, + &token_filters); + n = GRN_BULK_VSIZE(&token_filters) / sizeof(grn_obj *); + for (i = 0; i < n; i++) { + grn_obj *token_filter = GRN_PTR_VALUE_AT(&token_filters, i); + if (i > 0) { + rb_str_cat2(inspected, ", "); + } + rb_grn_object_inspect_object_content_name(inspected, context, + token_filter); + } + rb_str_cat2(inspected, "]"); + } + + { grn_obj *normalizer; rb_str_cat2(inspected, ", "); Modified: test/test-hash.rb (+4 -0) =================================================================== --- test/test-hash.rb 2014-11-06 15:36:36 +0900 (aaa0a06) +++ test/test-hash.rb 2014-11-06 15:45:47 +0900 (3a4b27e) @@ -129,6 +129,7 @@ class HashTest < Test::Unit::TestCase "size: <0>, " + "encoding: <#{encoding.inspect}>, " + "default_tokenizer: (nil), " + + "token_filters: [], " + "normalizer: (nil)>", anonymous_table.inspect) end @@ -145,6 +146,7 @@ class HashTest < Test::Unit::TestCase "size: <0>, " + "encoding: <#{encoding.inspect}>, " + "default_tokenizer: (nil), " + + "token_filters: [], " + "normalizer: (nil)>", anonymous_table.inspect) end @@ -162,6 +164,7 @@ class HashTest < Test::Unit::TestCase "size: <0>, " + "encoding: <#{encoding.inspect}>, " + "default_tokenizer: (nil), " + + "token_filters: [], " + "normalizer: (nil)>", named_table.inspect) end @@ -178,6 +181,7 @@ class HashTest < Test::Unit::TestCase "size: <0>, " + "encoding: <#{encoding.inspect}>, " + "default_tokenizer: (nil), " + + "token_filters: [], " + "normalizer: (nil)>", named_table.inspect) end Modified: test/test-schema.rb (+3 -0) =================================================================== --- test/test-schema.rb 2014-11-06 15:36:36 +0900 (47c15c4) +++ test/test-schema.rb 2014-11-06 15:45:47 +0900 (c2b6ecf) @@ -112,6 +112,7 @@ class SchemaTest < Test::Unit::TestCase "size: <0>, " + "encoding: <#{Groonga::Encoding.default.inspect}>, " + "default_tokenizer: <#{tokenizer.name}>, " + + "token_filters: [], " + "normalizer: (nil)>", table.inspect) end @@ -171,6 +172,7 @@ class SchemaTest < Test::Unit::TestCase "size: <0>, " + "encoding: <#{Groonga::Encoding.default.inspect}>, " + "default_tokenizer: <TokenBigram>, " + + "token_filters: [], " + "normalizer: <NormalizerAuto>>", table.inspect) end @@ -230,6 +232,7 @@ class SchemaTest < Test::Unit::TestCase "size: <0>, " + "encoding: <#{Groonga::Encoding.default.inspect}>, " + "default_tokenizer: <TokenBigram>, " + + "token_filters: [], " + "normalizer: <NormalizerAuto>>", table.inspect) end -------------- next part -------------- HTML����������������������������...下載