[Groonga-commit] groonga/groonga at cc930f2 [master] Optimize building scan_info for simple binary operation expression

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Apr 8 18:07:12 JST 2016


Kouhei Sutou	2016-04-08 18:07:12 +0900 (Fri, 08 Apr 2016)

  New Revision: cc930f2b59aed2da1bd6d95d80924188d4f2c3d3
  https://github.com/groonga/groonga/commit/cc930f2b59aed2da1bd6d95d80924188d4f2c3d3

  Message:
    Optimize building scan_info for simple binary operation expression

  Added files:
    test/command/suite/select/filter/simple/equal_only.expected
    test/command/suite/select/filter/simple/equal_only.test
    test/command/suite/select/filter/simple/greater_equal_only.expected
    test/command/suite/select/filter/simple/greater_equal_only.test
    test/command/suite/select/filter/simple/greater_only.expected
    test/command/suite/select/filter/simple/greater_only.test
    test/command/suite/select/filter/simple/less_equal_only.expected
    test/command/suite/select/filter/simple/less_equal_only.test
    test/command/suite/select/filter/simple/less_only.expected
    test/command/suite/select/filter/simple/less_only.test
    test/command/suite/select/filter/simple/match_only.expected
    test/command/suite/select/filter/simple/match_only.test
    test/command/suite/select/filter/simple/near_only.expected
    test/command/suite/select/filter/simple/near_only.test
    test/command/suite/select/filter/simple/not_equal_only.expected
    test/command/suite/select/filter/simple/not_equal_only.test
    test/command/suite/select/filter/simple/prefix_only.expected
    test/command/suite/select/filter/simple/prefix_only.test
    test/command/suite/select/filter/simple/regexp_only.expected
    test/command/suite/select/filter/simple/regexp_only.test
    test/command/suite/select/filter/simple/similar_only.expected
    test/command/suite/select/filter/simple/similar_only.test
    test/command/suite/select/filter/simple/term_extract_only.expected
    test/command/suite/select/filter/simple/term_extract_only.test
  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+69 -7)
===================================================================
--- lib/expr.c    2016-04-08 16:25:07 +0900 (01fe9b0)
+++ lib/expr.c    2016-04-08 18:07:12 +0900 (7601584)
@@ -4890,17 +4890,13 @@ grn_scan_info_build_simple(grn_ctx *ctx, grn_obj *expr, int *n,
                            grn_operator logical_op, grn_bool record_exist)
 {
   grn_expr *e = (grn_expr *)expr;
-  grn_expr_code *code;
-  grn_expr_code *code_end;
-
-  code = e->codes;
-  code_end = e->codes + e->codes_curr;
 
   if (e->codes_curr == 1) {
     scan_info **sis;
     scan_info *si;
+    grn_expr_code *target = e->codes;
 
-    switch (code->op) {
+    switch (target->op) {
     case GRN_OP_PUSH :
     case GRN_OP_GET_VALUE :
       break;
@@ -4916,7 +4912,73 @@ grn_scan_info_build_simple(grn_ctx *ctx, grn_obj *expr, int *n,
 
     si = sis[0];
     si->end = 0;
-    si->op = code->op;
+    si->op = target->op;
+    return sis;
+  } else if (e->codes_curr == 3) {
+    grn_expr_code *target;
+    grn_expr_code *constant;
+    grn_expr_code *operator;
+    scan_info **sis;
+    scan_info *si;
+
+    target   = e->codes + 0;
+    constant = e->codes + 1;
+    operator = e->codes + 2;
+
+    if (target->op != GRN_OP_GET_VALUE) {
+      return NULL;
+    }
+    if (target->nargs != 1) {
+      return NULL;
+    }
+    if (!target->value) {
+      return NULL;
+    }
+
+    if (constant->op != GRN_OP_PUSH) {
+      return NULL;
+    }
+    if (constant->nargs != 1) {
+      return NULL;
+    }
+    if (!constant->value) {
+      return NULL;
+    }
+
+    if (operator->nargs != 2) {
+      return NULL;
+    }
+    switch (operator->op) {
+    case GRN_OP_MATCH :
+    case GRN_OP_NEAR :
+    case GRN_OP_SIMILAR :
+    case GRN_OP_PREFIX :
+    case GRN_OP_SUFFIX :
+    case GRN_OP_EQUAL :
+    case GRN_OP_NOT_EQUAL :
+    case GRN_OP_LESS :
+    case GRN_OP_GREATER :
+    case GRN_OP_LESS_EQUAL :
+    case GRN_OP_GREATER_EQUAL :
+    case GRN_OP_TERM_EXTRACT :
+    case GRN_OP_REGEXP :
+      break;
+    default :
+      return NULL;
+      break;
+    }
+
+    sis = grn_scan_info_build_simple_open(ctx, n, logical_op);
+    if (!sis) {
+      return NULL;
+    }
+
+    si = sis[0];
+    si->end = 2;
+    si->op = operator->op;
+    si->args[si->nargs++] = target->value;
+    si->args[si->nargs++] = constant->value;
+    scan_info_build_match(ctx, si);
     return sis;
   }
 

  Added: test/command/suite/select/filter/simple/equal_only.expected (+22 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/equal_only.expected    2016-04-08 18:07:12 +0900 (c060252)
@@ -0,0 +1,22 @@
+table_create Logs TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+[[0,0.0,0.0],3]
+table_create Timestamps TABLE_HASH_KEY Time
+[[0,0.0,0.0],true]
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+[[0,0.0,0.0],true]
+log_level --level info
+[[0,0.0,0.0],true]
+select Logs --filter 'timestamp == "2016-04-08 00:00:01"'
+[[0,0.0,0.0],[[[1],[["_id","UInt32"],["timestamp","Time"]],[2,1460041201.0]]]]
+#|i| [table][select][index][equal] <Timestamps.index>
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/equal_only.test (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/equal_only.test    2016-04-08 18:07:12 +0900 (210d5c7)
@@ -0,0 +1,18 @@
+table_create Logs TABLE_NO_KEY
+column_create Logs timestamp COLUMN_SCALAR Time
+
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+
+table_create Timestamps TABLE_HASH_KEY Time
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+
+log_level --level info
+#@add-important-log-levels info
+select Logs --filter 'timestamp == "2016-04-08 00:00:01"'
+#@remove-important-log-levels info
+log_level --level notice

  Added: test/command/suite/select/filter/simple/greater_equal_only.expected (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/greater_equal_only.expected    2016-04-08 18:07:12 +0900 (9579c90)
@@ -0,0 +1,53 @@
+table_create Logs TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+[[0,0.0,0.0],3]
+table_create Timestamps TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+[[0,0.0,0.0],true]
+log_level --level info
+[[0,0.0,0.0],true]
+select Logs --filter 'timestamp >= "2016-04-08 00:00:01"'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        2,
+        1460041201.0
+      ],
+      [
+        3,
+        1460041202.0
+      ]
+    ]
+  ]
+]
+#|i| [table][select][index][range] <Timestamps>
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/greater_equal_only.test (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/greater_equal_only.test    2016-04-08 18:07:12 +0900 (0729c6d)
@@ -0,0 +1,18 @@
+table_create Logs TABLE_NO_KEY
+column_create Logs timestamp COLUMN_SCALAR Time
+
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+
+table_create Timestamps TABLE_PAT_KEY Time
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+
+log_level --level info
+#@add-important-log-levels info
+select Logs --filter 'timestamp >= "2016-04-08 00:00:01"'
+#@remove-important-log-levels info
+log_level --level notice

  Added: test/command/suite/select/filter/simple/greater_only.expected (+22 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/greater_only.expected    2016-04-08 18:07:12 +0900 (0bbd2c1)
@@ -0,0 +1,22 @@
+table_create Logs TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+[[0,0.0,0.0],3]
+table_create Timestamps TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+[[0,0.0,0.0],true]
+log_level --level info
+[[0,0.0,0.0],true]
+select Logs --filter 'timestamp > "2016-04-08 00:00:01"'
+[[0,0.0,0.0],[[[1],[["_id","UInt32"],["timestamp","Time"]],[3,1460041202.0]]]]
+#|i| [table][select][index][range] <Timestamps>
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/greater_only.test (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/greater_only.test    2016-04-08 18:07:12 +0900 (26c683c)
@@ -0,0 +1,18 @@
+table_create Logs TABLE_NO_KEY
+column_create Logs timestamp COLUMN_SCALAR Time
+
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+
+table_create Timestamps TABLE_PAT_KEY Time
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+
+log_level --level info
+#@add-important-log-levels info
+select Logs --filter 'timestamp > "2016-04-08 00:00:01"'
+#@remove-important-log-levels info
+log_level --level notice

  Added: test/command/suite/select/filter/simple/less_equal_only.expected (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/less_equal_only.expected    2016-04-08 18:07:12 +0900 (78eb411)
@@ -0,0 +1,53 @@
+table_create Logs TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+[[0,0.0,0.0],3]
+table_create Timestamps TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+[[0,0.0,0.0],true]
+log_level --level info
+[[0,0.0,0.0],true]
+select Logs --filter 'timestamp <= "2016-04-08 00:00:01"'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        1,
+        1460041200.0
+      ],
+      [
+        2,
+        1460041201.0
+      ]
+    ]
+  ]
+]
+#|i| [table][select][index][range] <Timestamps>
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/less_equal_only.test (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/less_equal_only.test    2016-04-08 18:07:12 +0900 (d451706)
@@ -0,0 +1,18 @@
+table_create Logs TABLE_NO_KEY
+column_create Logs timestamp COLUMN_SCALAR Time
+
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+
+table_create Timestamps TABLE_PAT_KEY Time
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+
+log_level --level info
+#@add-important-log-levels info
+select Logs --filter 'timestamp <= "2016-04-08 00:00:01"'
+#@remove-important-log-levels info
+log_level --level notice

  Added: test/command/suite/select/filter/simple/less_only.expected (+22 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/less_only.expected    2016-04-08 18:07:12 +0900 (43f3e78)
@@ -0,0 +1,22 @@
+table_create Logs TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+[[0,0.0,0.0],3]
+table_create Timestamps TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+[[0,0.0,0.0],true]
+log_level --level info
+[[0,0.0,0.0],true]
+select Logs --filter 'timestamp < "2016-04-08 00:00:01"'
+[[0,0.0,0.0],[[[1],[["_id","UInt32"],["timestamp","Time"]],[1,1460041200.0]]]]
+#|i| [table][select][index][range] <Timestamps>
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/less_only.test (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/less_only.test    2016-04-08 18:07:12 +0900 (1a7e076)
@@ -0,0 +1,18 @@
+table_create Logs TABLE_NO_KEY
+column_create Logs timestamp COLUMN_SCALAR Time
+
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+
+table_create Timestamps TABLE_PAT_KEY Time
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+
+log_level --level info
+#@add-important-log-levels info
+select Logs --filter 'timestamp < "2016-04-08 00:00:01"'
+#@remove-important-log-levels info
+log_level --level notice

  Added: test/command/suite/select/filter/simple/match_only.expected (+57 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/match_only.expected    2016-04-08 18:07:12 +0900 (9528751)
@@ -0,0 +1,57 @@
+table_create Logs TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs message COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+load --table Logs
+[
+{"message": "This host is shutting down"},
+{"message": "Start processing..."},
+{"message": "This host is booting"}
+]
+[[0,0.0,0.0],3]
+table_create Terms TABLE_PAT_KEY ShortText   --default_tokenizer TokenBigram   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+column_create Terms index COLUMN_INDEX|WITH_POSITION Logs message
+[[0,0.0,0.0],true]
+log_level --level info
+[[0,0.0,0.0],true]
+select Logs --filter 'message @ "host"'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "message",
+          "Text"
+        ]
+      ],
+      [
+        1,
+        "This host is shutting down"
+      ],
+      [
+        3,
+        "This host is booting"
+      ]
+    ]
+  ]
+]
+#|i| [object][search][index][key][exact] <Terms.index>
+#|i| grn_ii_sel > (host)
+#|i| n=1 (host)
+#|i| exact: 2
+#|i| hits=2
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/match_only.test (+20 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/match_only.test    2016-04-08 18:07:12 +0900 (8e8d35c)
@@ -0,0 +1,20 @@
+table_create Logs TABLE_NO_KEY
+column_create Logs message COLUMN_SCALAR Text
+
+load --table Logs
+[
+{"message": "This host is shutting down"},
+{"message": "Start processing..."},
+{"message": "This host is booting"}
+]
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Terms index COLUMN_INDEX|WITH_POSITION Logs message
+
+log_level --level info
+#@add-important-log-levels info
+select Logs --filter 'message @ "host"'
+#@remove-important-log-levels info
+log_level --level notice

  Added: test/command/suite/select/filter/simple/near_only.expected (+57 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/near_only.expected    2016-04-08 18:07:12 +0900 (e9c8dd9)
@@ -0,0 +1,57 @@
+table_create Logs TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs message COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+load --table Logs
+[
+{"message": "a     b c d e f g h i j k"},
+{"message": "a x   b c d e f g h i j k"},
+{"message": "a x x b c d e f g h i j k"}
+]
+[[0,0.0,0.0],3]
+table_create Terms TABLE_PAT_KEY ShortText   --default_tokenizer TokenBigram   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+column_create Terms index COLUMN_INDEX|WITH_POSITION Logs message
+[[0,0.0,0.0],true]
+log_level --level info
+[[0,0.0,0.0],true]
+select Logs --filter 'message *N "a k"'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "message",
+          "Text"
+        ]
+      ],
+      [
+        1,
+        "a     b c d e f g h i j k"
+      ],
+      [
+        2,
+        "a x   b c d e f g h i j k"
+      ]
+    ]
+  ]
+]
+#|i| [object][search][index][key][near] <Terms.index>
+#|i| grn_ii_sel > (a k)
+#|i| n=2 (a k)
+#|i| exact: 2
+#|i| hits=2
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/near_only.test (+20 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/near_only.test    2016-04-08 18:07:12 +0900 (b2c5f81)
@@ -0,0 +1,20 @@
+table_create Logs TABLE_NO_KEY
+column_create Logs message COLUMN_SCALAR Text
+
+load --table Logs
+[
+{"message": "a     b c d e f g h i j k"},
+{"message": "a x   b c d e f g h i j k"},
+{"message": "a x x b c d e f g h i j k"}
+]
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Terms index COLUMN_INDEX|WITH_POSITION Logs message
+
+log_level --level info
+#@add-important-log-levels info
+select Logs --filter 'message *N "a k"'
+#@remove-important-log-levels info
+log_level --level notice

  Added: test/command/suite/select/filter/simple/not_equal_only.expected (+52 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/not_equal_only.expected    2016-04-08 18:07:12 +0900 (4956124)
@@ -0,0 +1,52 @@
+table_create Logs TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+[[0,0.0,0.0],3]
+table_create Timestamps TABLE_HASH_KEY Time
+[[0,0.0,0.0],true]
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+[[0,0.0,0.0],true]
+log_level --level info
+[[0,0.0,0.0],true]
+select Logs --filter 'timestamp != "2016-04-08 00:00:01"'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        1,
+        1460041200.0
+      ],
+      [
+        3,
+        1460041202.0
+      ]
+    ]
+  ]
+]
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/not_equal_only.test (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/not_equal_only.test    2016-04-08 18:07:12 +0900 (2833718)
@@ -0,0 +1,18 @@
+table_create Logs TABLE_NO_KEY
+column_create Logs timestamp COLUMN_SCALAR Time
+
+load --table Logs
+[
+{"timestamp": "2016-04-08 00:00:00"},
+{"timestamp": "2016-04-08 00:00:01"},
+{"timestamp": "2016-04-08 00:00:02"}
+]
+
+table_create Timestamps TABLE_HASH_KEY Time
+column_create Timestamps index COLUMN_INDEX Logs timestamp
+
+log_level --level info
+#@add-important-log-levels info
+select Logs --filter 'timestamp != "2016-04-08 00:00:01"'
+#@remove-important-log-levels info
+log_level --level notice

  Added: test/command/suite/select/filter/simple/prefix_only.expected (+47 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/prefix_only.expected    2016-04-08 18:07:12 +0900 (f342b2b)
@@ -0,0 +1,47 @@
+table_create Tags TABLE_PAT_KEY ShortText   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+load --table Tags
+[
+{"_key": "shutdown"},
+{"_key": "start"},
+{"_key": "boot"}
+]
+[[0,0.0,0.0],3]
+log_level --level info
+[[0,0.0,0.0],true]
+select Tags --filter '_key @^ "s"'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ]
+      ],
+      [
+        2,
+        "start"
+      ],
+      [
+        1,
+        "shutdown"
+      ]
+    ]
+  ]
+]
+#|i| [table][select][index][prefix][accessor][key] <Tags>
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/prefix_only.test (+15 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/prefix_only.test    2016-04-08 18:07:12 +0900 (70cf7d7)
@@ -0,0 +1,15 @@
+table_create Tags TABLE_PAT_KEY ShortText \
+  --normalizer NormalizerAuto
+
+load --table Tags
+[
+{"_key": "shutdown"},
+{"_key": "start"},
+{"_key": "boot"}
+]
+
+log_level --level info
+#@add-important-log-levels info
+select Tags --filter '_key @^ "s"'
+#@remove-important-log-levels info
+log_level --level notice

  Added: test/command/suite/select/filter/simple/regexp_only.expected (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/regexp_only.expected    2016-04-08 18:07:12 +0900 (d633b0d)
@@ -0,0 +1,53 @@
+table_create Logs TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs message COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+load --table Logs
+[
+{"message": "This host is shutting down"},
+{"message": "Start processing..."},
+{"message": "Boot this host"}
+]
+[[0,0.0,0.0],3]
+table_create Terms TABLE_PAT_KEY ShortText   --default_tokenizer TokenRegexp   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+column_create Terms index COLUMN_INDEX|WITH_POSITION Logs message
+[[0,0.0,0.0],true]
+log_level --level info
+[[0,0.0,0.0],true]
+select Logs --filter 'message @~ "\\\\Athis"'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        1
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "message",
+          "Text"
+        ]
+      ],
+      [
+        1,
+        "This host is shutting down"
+      ]
+    ]
+  ]
+]
+#|i| [object][search][index][key][regexp] <Terms.index>
+#|i| grn_ii_sel > (\Athis)
+#|i| n=3 (￯this)
+#|i| exact: 1
+#|i| hits=1
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/regexp_only.test (+20 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/regexp_only.test    2016-04-08 18:07:12 +0900 (fca4aa8)
@@ -0,0 +1,20 @@
+table_create Logs TABLE_NO_KEY
+column_create Logs message COLUMN_SCALAR Text
+
+load --table Logs
+[
+{"message": "This host is shutting down"},
+{"message": "Start processing..."},
+{"message": "Boot this host"}
+]
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenRegexp \
+  --normalizer NormalizerAuto
+column_create Terms index COLUMN_INDEX|WITH_POSITION Logs message
+
+log_level --level info
+#@add-important-log-levels info
+select Logs --filter 'message @~ "\\\\Athis"'
+#@remove-important-log-levels info
+log_level --level notice

  Added: test/command/suite/select/filter/simple/similar_only.expected (+52 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/similar_only.expected    2016-04-08 18:07:12 +0900 (c696188)
@@ -0,0 +1,52 @@
+table_create Logs TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs message COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+load --table Logs
+[
+{"message": "This host is shutting down"},
+{"message": "Start processing..."},
+{"message": "This host is booting"}
+]
+[[0,0.0,0.0],3]
+table_create Terms TABLE_PAT_KEY ShortText   --default_tokenizer TokenBigram   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+column_create Terms index COLUMN_INDEX|WITH_POSITION Logs message
+[[0,0.0,0.0],true]
+log_level --level info
+[[0,0.0,0.0],true]
+select Logs --filter 'message *S "Start that host"'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        1
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "message",
+          "Text"
+        ]
+      ],
+      [
+        2,
+        "Start processing..."
+      ]
+    ]
+  ]
+]
+#|i| [object][search][index][key][similar] <Terms.index>
+#|i| grn_ii_sel > (Start that host)
+#|i| exact: 1
+#|i| hits=1
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/similar_only.test (+20 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/similar_only.test    2016-04-08 18:07:12 +0900 (9a7a228)
@@ -0,0 +1,20 @@
+table_create Logs TABLE_NO_KEY
+column_create Logs message COLUMN_SCALAR Text
+
+load --table Logs
+[
+{"message": "This host is shutting down"},
+{"message": "Start processing..."},
+{"message": "This host is booting"}
+]
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Terms index COLUMN_INDEX|WITH_POSITION Logs message
+
+log_level --level info
+#@add-important-log-levels info
+select Logs --filter 'message *S "Start that host"'
+#@remove-important-log-levels info
+log_level --level notice

  Added: test/command/suite/select/filter/simple/term_extract_only.expected (+47 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/term_extract_only.expected    2016-04-08 18:07:12 +0900 (0edee9b)
@@ -0,0 +1,47 @@
+table_create Tags TABLE_PAT_KEY ShortText   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+load --table Tags
+[
+{"_key": "shutdown"},
+{"_key": "start"},
+{"_key": "boot"}
+]
+[[0,0.0,0.0],3]
+log_level --level info
+[[0,0.0,0.0],true]
+select Tags --filter '_key *T "start and shutdown this site"'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ]
+      ],
+      [
+        2,
+        "start"
+      ],
+      [
+        1,
+        "shutdown"
+      ]
+    ]
+  ]
+]
+#|i| [table][select][index][term-extract][accessor][key] <Tags>
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/select/filter/simple/term_extract_only.test (+15 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/simple/term_extract_only.test    2016-04-08 18:07:12 +0900 (896fba0)
@@ -0,0 +1,15 @@
+table_create Tags TABLE_PAT_KEY ShortText \
+  --normalizer NormalizerAuto
+
+load --table Tags
+[
+{"_key": "shutdown"},
+{"_key": "start"},
+{"_key": "boot"}
+]
+
+log_level --level info
+#@add-important-log-levels info
+select Tags --filter '_key *T "start and shutdown this site"'
+#@remove-important-log-levels info
+log_level --level notice
-------------- next part --------------
HTML����������������������������...
Download 



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