[Groonga-commit] droonga/droonga-engine at 172e515 [master] Groonga select: Support ALLOW_LEADING_NOT for query_flags

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Oct 7 12:28:18 JST 2014


YUKI Hiroshi	2014-10-07 12:28:18 +0900 (Tue, 07 Oct 2014)

  New Revision: 172e5150f8f008d65256e832828e55dd26401fcf
  https://github.com/droonga/droonga-engine/commit/172e5150f8f008d65256e832828e55dd26401fcf

  Message:
    Groonga select: Support ALLOW_LEADING_NOT for query_flags

  Modified files:
    lib/droonga/plugins/groonga/select.rb
    test/unit/plugins/groonga/select/test_adapter_input.rb

  Modified: lib/droonga/plugins/groonga/select.rb (+1 -1)
===================================================================
--- lib/droonga/plugins/groonga/select.rb    2014-10-07 12:24:41 +0900 (b5f4cf3)
+++ lib/droonga/plugins/groonga/select.rb    2014-10-07 12:28:18 +0900 (d026b68)
@@ -120,9 +120,9 @@ module Droonga
             flags = flags.split("|")
             condition["allowPragma"] = flags.include?("ALLOW_PRAGMA")
             condition["allowColumn"] = flags.include?("ALLOW_COLUMN")
+            condition["allowLeadingNot"] = flags.include?("ALLOW_LEADING_NOT")
             #XXX not supported yet by the "search" command
             # condition["allowUpdate"] = flags.include?("ALLOW_UPDATE")
-            # condition["allowLeadingNot"] = flags.include?("ALLOW_LEADING_NOT")
           end
 
           def convert_drilldown(select_request)

  Modified: test/unit/plugins/groonga/select/test_adapter_input.rb (+24 -0)
===================================================================
--- test/unit/plugins/groonga/select/test_adapter_input.rb    2014-10-07 12:24:41 +0900 (2d6bc06)
+++ test/unit/plugins/groonga/select/test_adapter_input.rb    2014-10-07 12:28:18 +0900 (02da9ac)
@@ -85,6 +85,7 @@ class GroongaSelectAdapterInputTest < Test::Unit::TestCase
               "defaultOperator"=> "&&",
               "allowPragma"=> true,
               "allowColumn"=> true,
+              "allowLeadingNot" => false,
             },
             "output"   => {
               "elements"   => [
@@ -167,6 +168,7 @@ class GroongaSelectAdapterInputTest < Test::Unit::TestCase
                 "defaultOperator"=> "&&",
                 "allowPragma"=> true,
                 "allowColumn"=> true,
+                "allowLeadingNot" => false,
               },
               "title@'FilterTest'",
             ],
@@ -203,6 +205,7 @@ class GroongaSelectAdapterInputTest < Test::Unit::TestCase
         "defaultOperator"=> "&&",
         "allowPragma" => false,
         "allowColumn" => false,
+        "allowLeadingNot" => false,
       }
       assert_equal(expected_search_condition,
                    convert(select_request)["queries"]["EmptyTable_result"]["condition"])
@@ -221,6 +224,7 @@ class GroongaSelectAdapterInputTest < Test::Unit::TestCase
         "defaultOperator"=> "&&",
         "allowPragma" => true,
         "allowColumn" => false,
+        "allowLeadingNot" => false,
       }
       assert_equal(expected_search_condition,
                    convert(select_request)["queries"]["EmptyTable_result"]["condition"])
@@ -239,6 +243,26 @@ class GroongaSelectAdapterInputTest < Test::Unit::TestCase
         "defaultOperator"=> "&&",
         "allowPragma" => false,
         "allowColumn" => true,
+        "allowLeadingNot" => false,
+      }
+      assert_equal(expected_search_condition,
+                   convert(select_request)["queries"]["EmptyTable_result"]["condition"])
+    end
+
+    def test_allow_leading_not_only
+      select_request = {
+        "table"          => "EmptyTable",
+        "match_columns"  => "_key",
+        "query"          => "QueryTest",
+        "query_flags"    => "ALLOW_LEADING_NOT",
+      }
+      expected_search_condition = {
+        "query"  => "QueryTest",
+        "matchTo"=> ["_key"],
+        "defaultOperator"=> "&&",
+        "allowPragma" => false,
+        "allowColumn" => false,
+        "allowLeadingNot" => true,
       }
       assert_equal(expected_search_condition,
                    convert(select_request)["queries"]["EmptyTable_result"]["condition"])
-------------- next part --------------
HTML����������������������������...
Download 



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