[Groonga-commit] droonga/fluent-plugin-droonga at d023dc8 [master] search: care about nonexistent column reference case

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Apr 10 18:25:25 JST 2014


Kouhei Sutou	2014-04-10 18:25:25 +0900 (Thu, 10 Apr 2014)

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

  Message:
    search: care about nonexistent column reference case

  Added files:
    test/command/suite/search/condition/query/nonexistent_column.catalog.json
    test/command/suite/search/condition/query/nonexistent_column.expected
    test/command/suite/search/condition/query/nonexistent_column.test
  Modified files:
    lib/droonga/searcher.rb

  Modified: lib/droonga/searcher.rb (+1 -1)
===================================================================
--- lib/droonga/searcher.rb    2014-04-10 18:24:54 +0900 (0808c96)
+++ lib/droonga/searcher.rb    2014-04-10 18:25:25 +0900 (eeccb87)
@@ -293,7 +293,7 @@ module Droonga
           end
           begin
             expression.parse(query, options)
-          rescue Groonga::SyntaxError
+          rescue Groonga::SyntaxError, Groonga::InvalidArgument
             raise SyntaxError.new("query", query)
           end
         elsif condition["script"]

  Added: test/command/suite/search/condition/query/nonexistent_column.catalog.json (+37 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/search/condition/query/nonexistent_column.catalog.json    2014-04-10 18:25:25 +0900 (7dee90b)
@@ -0,0 +1,37 @@
+{
+  "datasets": {
+    "Droonga": {
+      "fact": "Memos",
+      "schema": {
+        "Memos": {
+          "type": "Hash",
+          "keyType": "ShortText",
+          "columns": {
+            "content": {
+              "type": "Scalar",
+              "valueType": "Text"
+            }
+          }
+        },
+        "Terms": {
+          "type": "PatriciaTrie",
+          "keyType": "ShortText",
+          "tokenizer": "TokenBigram",
+          "normalizer": "NormalizerAuto",
+          "columns": {
+            "memos_index": {
+              "type": "Index",
+              "valueType": "Memos",
+              "indexOptions": {
+                "sources": [
+                  "content"
+                ]
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
+

  Added: test/command/suite/search/condition/query/nonexistent_column.expected (+48 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/search/condition/query/nonexistent_column.expected    2014-04-10 18:25:25 +0900 (36079a8)
@@ -0,0 +1,48 @@
+{
+  "inReplyTo": "request-id",
+  "statusCode": 400,
+  "type": "search.result",
+  "body": {
+    "name": "SyntaxError",
+    "message": "Syntax error: syntax:<query> input:<nonexistent:Droonga>",
+    "detail": {
+      "syntax": "query",
+      "input": "nonexistent:Droonga"
+    }
+  },
+  "errors": {
+    "sources0": {
+      "statusCode": 400,
+      "body": {
+        "name": "SyntaxError",
+        "message": "Syntax error: syntax:<query> input:<nonexistent:Droonga>",
+        "detail": {
+          "syntax": "query",
+          "input": "nonexistent:Droonga"
+        }
+      }
+    },
+    "sources1": {
+      "statusCode": 400,
+      "body": {
+        "name": "SyntaxError",
+        "message": "Syntax error: syntax:<query> input:<nonexistent:Droonga>",
+        "detail": {
+          "syntax": "query",
+          "input": "nonexistent:Droonga"
+        }
+      }
+    },
+    "sources2": {
+      "statusCode": 400,
+      "body": {
+        "name": "SyntaxError",
+        "message": "Syntax error: syntax:<query> input:<nonexistent:Droonga>",
+        "detail": {
+          "syntax": "query",
+          "input": "nonexistent:Droonga"
+        }
+      }
+    }
+  }
+}

  Added: test/command/suite/search/condition/query/nonexistent_column.test (+33 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/search/condition/query/nonexistent_column.test    2014-04-10 18:25:25 +0900 (8552006)
@@ -0,0 +1,33 @@
+# -*- js -*-
+#@require-catalog-version 2
+#@disable-logging
+{
+  "type": "add",
+  "dataset": "Droonga",
+  "body": {
+    "table": "Memos",
+    "key": "droonga",
+    "values": {
+      "content": "Droonga is fun!"
+    }
+  }
+}
+#@enable-logging
+{
+  "type": "search",
+  "dataset": "Droonga",
+  "body": {
+    "queries": {
+      "memos": {
+        "source": "Memos",
+        "condition": {
+          "matchTo": ["content"],
+          "query": "nonexistent:Droonga"
+        },
+        "output": {
+          "elements": ["count"]
+        }
+      }
+    }
+  }
+}
-------------- next part --------------
HTML����������������������������...
Download 



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