[Groonga-commit] droonga/fluent-plugin-droonga at 5ff73ad [master] Add an object for vectorOptions

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Mar 14 17:10:20 JST 2014


Kouhei Sutou	2014-03-14 17:10:20 +0900 (Fri, 14 Mar 2014)

  New Revision: 5ff73ad7c16263dc5c8bd5ac732b34ca147a5028
  https://github.com/droonga/fluent-plugin-droonga/commit/5ff73ad7c16263dc5c8bd5ac732b34ca147a5028

  Message:
    Add an object for vectorOptions
    
    But it isn't used yet.

  Modified files:
    lib/droonga/catalog/schema.rb
    test/unit/catalog/test_schema.rb

  Modified: lib/droonga/catalog/schema.rb (+16 -0)
===================================================================
--- lib/droonga/catalog/schema.rb    2014-03-14 17:04:39 +0900 (1e9b9b7)
+++ lib/droonga/catalog/schema.rb    2014-03-14 17:10:20 +0900 (03041ff)
@@ -18,6 +18,22 @@ require "tsort"
 module Droonga
   module Catalog
     class Schema
+      class ColumnVectorOptions
+        def initialize(data)
+          @data = data
+        end
+
+        def weight
+          @data["weight"]
+        end
+
+        def flags
+          flags = []
+          flags << "WITH_WEIGHT" if weight
+          flags
+        end
+      end
+
       class ColumnIndexOptions
         def initialize(data)
           @data = data

  Modified: test/unit/catalog/test_schema.rb (+23 -0)
===================================================================
--- test/unit/catalog/test_schema.rb    2014-03-14 17:04:39 +0900 (a86b951)
+++ test/unit/catalog/test_schema.rb    2014-03-14 17:10:20 +0900 (864f9df)
@@ -248,6 +248,29 @@ class CatalogSchemaTest < Test::Unit::TestCase
       end
     end
 
+    class ColumnVectorOptionsTest < self
+      def create_options(data)
+        Droonga::Catalog::Schema::ColumnVectorOptions.new(data)
+      end
+
+      def test_weight
+        data = {
+          "weight" => true
+        }
+        options = create_options(data)
+        assert_equal(true, options.weight)
+      end
+
+      def test_flags
+        data = {
+          "weight" => true
+        }
+        options = create_options(data)
+        assert_equal(["WITH_WEIGHT"],
+                     options.flags)
+      end
+    end
+
     class ColumnIndexOptionsTest < self
       def create_options(data)
         Droonga::Catalog::Schema::ColumnIndexOptions.new(data)
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index