[Groonga-commit] droonga/droonga.org at 98d47e4 [gh-pages] Add matching pattern reference (WIP)

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Feb 17 20:15:23 JST 2014


YUKI Hiroshi	2014-02-17 20:15:23 +0900 (Mon, 17 Feb 2014)

  New Revision: 98d47e45974692cf877f9c5e1ad89b6aa57fdd04
  https://github.com/droonga/droonga.org/commit/98d47e45974692cf877f9c5e1ad89b6aa57fdd04

  Message:
    Add matching pattern reference (WIP)

  Added files:
    reference/plugin/matching-pattern/index.md

  Added: reference/plugin/matching-pattern/index.md (+83 -0) 100644
===================================================================
--- /dev/null
+++ reference/plugin/matching-pattern/index.md    2014-02-17 20:15:23 +0900 (5b913b3)
@@ -0,0 +1,83 @@
+---
+title: Matching pattern for messages
+layout: en
+---
+
+* TOC
+{:toc}
+
+
+## Abstract {#abstract}
+
+The Droonga Engine provides a tiny language to specify patterns of messages, called *matching pattern*.
+It is used to specify target messages of various operations, ex. plugins.
+
+
+## Examples {#examples}
+
+### Simple matching
+
+    pattern = ["type", :equal, "search"]
+
+This matches to messages like:
+
+    {
+      "type": "search",
+      ...
+    }
+
+### Matching for a deep target
+
+    pattern = ["body.success", :equal, true]
+
+This matches to messages like:
+
+    {
+      "type": "add.result",
+      "body": {
+        "result": true
+      }
+    }
+
+Not matches to:
+
+    {
+      "type": "add.result",
+      "body": {
+        "result": false
+      }
+    }
+
+### Nested patterns
+
+    pattern = [
+                 ["type", :equal, "table_create"],
+                 :or,
+                 ["type", :equal, "column_create"]
+              ]
+
+This matches to both:
+
+    {
+      "type": "table_create",
+      ...
+    }
+
+and:
+
+    {
+      "type": "column_create",
+      ...
+    }
+
+
+## Syntax {#syntax}
+
+
+ * `PATTERN` = [`TARGET_PATH`, `OPERATOR`, `ARGUMENTS*`]
+ * `PATTERN` = [`PATTERN, LOGICAL_OPERATOR`, `PATTERN`]
+ * `TARGET_PATH` = `"COMPONENT(.COMPONENT)*"`
+ * `OPERATOR` = `:equal`, `:in`, `:include`, `:exist`, `:start_with`
+ * `ARGUMENTS` = ``OBJECT_DEFINED_IN_JSON*`
+ * `LOGICAL_OPERATOR` = `:or`
+
-------------- next part --------------
HTML����������������������������...
Download 



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