Kouhei Sutou
null+****@clear*****
Fri Mar 14 17:18:27 JST 2014
Kouhei Sutou 2014-03-14 17:18:27 +0900 (Fri, 14 Mar 2014) New Revision: 2735180db8785899048e4198e36894966c8da175 https://github.com/droonga/fluent-plugin-droonga/commit/2735180db8785899048e4198e36894966c8da175 Message: schema: support vectorOptions Modified files: lib/droonga/catalog/schema.rb test/unit/catalog/test_schema.rb Modified: lib/droonga/catalog/schema.rb (+7 -2) =================================================================== --- lib/droonga/catalog/schema.rb 2014-03-14 17:16:59 +0900 (03041ff) +++ lib/droonga/catalog/schema.rb 2014-03-14 17:18:27 +0900 (8959d09) @@ -65,11 +65,12 @@ module Droonga end class Column - attr_reader :table, :name, :data, :index_options + attr_reader :table, :name, :data, :vector_options, :index_options def initialize(table, name, data) @table = table @name = name @data = data + @vector_options = ColumnVectorOptions.new(vector_options_data) @index_options = ColumnIndexOptions.new(index_options_data) end @@ -97,7 +98,7 @@ module Droonga end def flags - [type_flag] + index_options.flags + [type_flag] + vector_options.flags + index_options.flags end def value_type @@ -128,6 +129,10 @@ module Droonga end private + def vector_options_data + @data["vectorOptions"] || {} + end + def index_options_data @data["indexOptions"] || {} end Modified: test/unit/catalog/test_schema.rb (+11 -0) =================================================================== --- test/unit/catalog/test_schema.rb 2014-03-14 17:16:59 +0900 (27d57e8) +++ test/unit/catalog/test_schema.rb 2014-03-14 17:18:27 +0900 (ddcaa03) @@ -241,6 +241,17 @@ class CatalogSchemaTest < Test::Unit::TestCase flags(data)) end + def test_weight_options + data = { + "type" => "Vector", + "vectorOptions" => { + "weight" => true + } + } + assert_equal(["COLUMN_VECTOR", "WITH_WEIGHT"], + flags(data)) + end + def test_index_options data = { "type" => "Index", -------------- next part -------------- HTML����������������������������... Download