[Groonga-commit] groonga/groonga at a748e2f [master] select: add match_escalation parameter

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Mar 8 15:48:54 JST 2018


Kouhei Sutou	2018-03-08 15:48:54 +0900 (Thu, 08 Mar 2018)

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

  Message:
    select: add match_escalation parameter
    
    You can force to enable match escalation by --match_escalation
    yes. It's stronger than --match_escalation_threshold 99999....999.
    Because --match_escalation yes also works with "SOME_CONDITIONS &&
    column @ 'query'". --match_escalation_threshold isn't used the case.
    
    The default is --match_escalation auto. It doesn't change the current
    behavior.
    
    You can disable match escalation by --match_escalation no. It's the
    same as --match_escalation_threshold -1.

  Added files:
    test/command/suite/select/match_escalation/auto.expected
    test/command/suite/select/match_escalation/auto.test
    test/command/suite/select/match_escalation/match_columns.expected
    test/command/suite/select/match_escalation/match_columns.test
    test/command/suite/select/match_escalation/no.expected
    test/command/suite/select/match_escalation/no.test
    test/command/suite/select/match_escalation/yes.expected
    test/command/suite/select/match_escalation/yes.test
  Modified files:
    include/groonga/groonga.h
    lib/ctx.c
    lib/expr.c
    lib/grn_ctx_impl.h
    lib/ii.c
    lib/proc/proc_select.c
    test/command/suite/select/filter/unary_operation/match_and_not_not_match.expected

  Modified: include/groonga/groonga.h (+3 -0)
===================================================================
--- include/groonga/groonga.h    2018-03-07 17:12:17 +0900 (01c9c1ff6)
+++ include/groonga/groonga.h    2018-03-08 15:48:54 +0900 (24a449de3)
@@ -269,6 +269,8 @@ GRN_API grn_command_version grn_ctx_get_command_version(grn_ctx *ctx);
 GRN_API grn_rc grn_ctx_set_command_version(grn_ctx *ctx, grn_command_version version);
 GRN_API long long int grn_ctx_get_match_escalation_threshold(grn_ctx *ctx);
 GRN_API grn_rc grn_ctx_set_match_escalation_threshold(grn_ctx *ctx, long long int threshold);
+GRN_API grn_bool grn_ctx_get_force_match_escalation(grn_ctx *ctx);
+GRN_API grn_rc grn_ctx_set_force_match_escalation(grn_ctx *ctx, grn_bool force);
 GRN_API long long int grn_get_default_match_escalation_threshold(void);
 GRN_API grn_rc grn_set_default_match_escalation_threshold(long long int threshold);
 
@@ -787,6 +789,7 @@ struct _grn_fuzzy_search_optarg {
 };
 
 #define GRN_MATCH_INFO_GET_MIN_RECORD_ID                           (0x01)
+#define GRN_MATCH_INFO_ONLY_SKIP_TOKEN                             (0x02)
 
 typedef struct _grn_match_info grn_match_info;
 

  Modified: lib/ctx.c (+22 -0)
===================================================================
--- lib/ctx.c    2018-03-07 17:12:17 +0900 (2d391c957)
+++ lib/ctx.c    2018-03-08 15:48:54 +0900 (f9f5627bf)
@@ -288,6 +288,7 @@ grn_ctx_impl_init(grn_ctx *ctx)
     ctx->impl->match_escalation_threshold =
       grn_get_default_match_escalation_threshold();
   }
+  ctx->impl->force_match_escalation = GRN_FALSE;
 
   ctx->impl->finalizer = NULL;
 
@@ -905,6 +906,27 @@ grn_ctx_set_match_escalation_threshold(grn_ctx *ctx, long long int threshold)
   return GRN_SUCCESS;
 }
 
+grn_bool
+grn_ctx_get_force_match_escalation(grn_ctx *ctx)
+{
+  if (ctx->impl) {
+    return ctx->impl->force_match_escalation;
+  } else {
+    return GRN_FALSE;
+  }
+}
+
+grn_rc
+grn_ctx_set_force_match_escalation(grn_ctx *ctx, grn_bool force)
+{
+  if (ctx->impl) {
+    ctx->impl->force_match_escalation = force;
+    return GRN_SUCCESS;
+  } else {
+    return GRN_INVALID_ARGUMENT;
+  }
+}
+
 grn_content_type
 grn_get_ctype(grn_obj *var)
 {

  Modified: lib/expr.c (+5 -3)
===================================================================
--- lib/expr.c    2018-03-07 17:12:17 +0900 (435315758)
+++ lib/expr.c    2018-03-08 15:48:54 +0900 (b7a6726e8)
@@ -6376,7 +6376,7 @@ grn_table_select_index_match(grn_ctx *ctx,
   optarg.vector_size = 1;
   optarg.proc = NULL;
   optarg.max_size = 0;
-  optarg.match_info.flags |= GRN_MATCH_INFO_GET_MIN_RECORD_ID;
+  optarg.match_info.flags = GRN_MATCH_INFO_GET_MIN_RECORD_ID;
   ctx->flags |= GRN_CTX_TEMPORARY_DISABLE_II_RESOLVE_SEL_AND;
   for (j = 0; j < n_indexes; j++, ip++, wp += 2) {
     uint32_t sid = (uint32_t) wp[0];
@@ -6408,8 +6408,6 @@ grn_table_select_index_match(grn_ctx *ctx,
       GRN_UINT32_VALUE_AT(&(si->scorer_args_expr_offsets), j);
     if (j < n_indexes - 1) {
       if (sid && ip[0] == ip[1]) { continue; }
-    } else {
-      ctx->flags &= ~GRN_CTX_TEMPORARY_DISABLE_II_RESOLVE_SEL_AND;
     }
     grn_obj_search(ctx, ip[0], si->query, res, si->logical_op, &optarg);
     if (optarg.weight_vector) {
@@ -6425,6 +6423,10 @@ grn_table_select_index_match(grn_ctx *ctx,
       minimum_min_id = optarg.match_info.min;
     }
   }
+  ctx->flags &= ~GRN_CTX_TEMPORARY_DISABLE_II_RESOLVE_SEL_AND;
+  if (!(optarg.match_info.flags & GRN_MATCH_INFO_ONLY_SKIP_TOKEN)) {
+    grn_ii_resolve_sel_and(ctx, (grn_hash *)res, si->logical_op);
+  }
   if ((si->logical_op == GRN_OP_AND) ||
       (si->logical_op == GRN_OP_OR && previous_n_hits == 0)) {
     *min_id = minimum_min_id;

  Modified: lib/grn_ctx_impl.h (+2 -1)
===================================================================
--- lib/grn_ctx_impl.h    2018-03-07 17:12:17 +0900 (ff2e79d92)
+++ lib/grn_ctx_impl.h    2018-03-08 15:48:54 +0900 (b0e2513e9)
@@ -1,6 +1,6 @@
 /* -*- c-basic-offset: 2 -*- */
 /*
-  Copyright(C) 2009-2017 Brazil
+  Copyright(C) 2009-2018 Brazil
 
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
@@ -212,6 +212,7 @@ struct _grn_ctx_impl {
 
   /* match escalation portion */
   int64_t match_escalation_threshold;
+  grn_bool force_match_escalation;
 
   /* lifetime portion */
   grn_proc_func *finalizer;

  Modified: lib/ii.c (+18 -9)
===================================================================
--- lib/ii.c    2018-03-07 17:12:17 +0900 (42fdbd421)
+++ lib/ii.c    2018-03-08 15:48:54 +0900 (fd33f02b4)
@@ -7827,6 +7827,7 @@ typedef struct {
   grn_id previous_min;
   grn_id current_min;
   grn_bool set_min_enable_for_and_query;
+  grn_bool only_skip_token;
 } grn_ii_select_data;
 
 static void
@@ -7841,6 +7842,7 @@ grn_ii_select_data_init(grn_ctx *ctx,
   data->previous_min = GRN_ID_NIL;
   data->current_min = GRN_ID_NIL;
   data->set_min_enable_for_and_query = GRN_FALSE;
+  data->only_skip_token = GRN_FALSE;
 
   if (!optarg) {
     return;
@@ -7899,6 +7901,10 @@ grn_ii_select_data_fin(grn_ctx *ctx,
       data->optarg->match_info->min = data->current_min;
     }
   }
+
+  if (data->only_skip_token && data->optarg && data->optarg->match_info) {
+    data->optarg->match_info->flags |= GRN_MATCH_INFO_ONLY_SKIP_TOKEN;
+  }
 }
 
 typedef struct {
@@ -8828,7 +8834,6 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii,
   int rep, orp, weight, max_interval = 0;
   token_info *ti, **tis = NULL, **tip, **tie;
   uint32_t n = 0, rid, sid, nrid, nsid;
-  grn_bool only_skip_token = GRN_FALSE;
   grn_obj *lexicon;
   grn_ii_select_data data;
 
@@ -8869,14 +8874,15 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii,
   }
   if (data.mode == GRN_OP_FUZZY) {
     if (token_info_build_fuzzy(ctx, lexicon, ii, string, string_len,
-                               tis, &n, &only_skip_token, data.previous_min,
+                               tis, &n, &(data.only_skip_token),
+                               data.previous_min,
                                data.mode, &(optarg->fuzzy)) ||
         !n) {
       goto exit;
     }
   } else {
     if (token_info_build(ctx, lexicon, ii, string, string_len,
-                         tis, &n, &only_skip_token, data.previous_min,
+                         tis, &n, &(data.only_skip_token), data.previous_min,
                          data.mode) ||
         !n) {
       goto exit;
@@ -9073,15 +9079,16 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii,
     if (token_info_skip(ctx, *tis, nrid, nsid)) { goto exit; }
   }
 exit :
+  if (!data.only_skip_token) {
+    grn_ii_resolve_sel_and(ctx, s, op);
+  }
+
   grn_ii_select_data_fin(ctx, &data);
 
   for (tip = tis; tip < tis + n; tip++) {
     if (*tip) { token_info_close(ctx, *tip); }
   }
   if (tis) { GRN_FREE(tis); }
-  if (!only_skip_token) {
-    grn_ii_resolve_sel_and(ctx, s, op);
-  }
   //  grn_hash_cursor_clear(r);
   bt_close(ctx, bt);
 #ifdef DEBUG
@@ -9299,9 +9306,10 @@ grn_ii_sel(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_len
       return ctx->rc;
     }
     GRN_LOG(ctx, GRN_LOG_INFO, "exact: %d", GRN_HASH_SIZE(s));
-    if (op == GRN_OP_OR) {
+    if (op == GRN_OP_OR || ctx->impl->force_match_escalation) {
       grn_id min = GRN_ID_NIL;
-      if ((int64_t)GRN_HASH_SIZE(s) <= ctx->impl->match_escalation_threshold) {
+      if ((int64_t)GRN_HASH_SIZE(s) <= ctx->impl->match_escalation_threshold ||
+          ctx->impl->force_match_escalation) {
         arg.mode = GRN_OP_UNSPLIT;
         if (arg.match_info) {
           if (arg.match_info->flags & GRN_MATCH_INFO_GET_MIN_RECORD_ID) {
@@ -9323,7 +9331,8 @@ grn_ii_sel(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_len
           }
         }
       }
-      if ((int64_t)GRN_HASH_SIZE(s) <= ctx->impl->match_escalation_threshold) {
+      if ((int64_t)GRN_HASH_SIZE(s) <= ctx->impl->match_escalation_threshold ||
+          ctx->impl->force_match_escalation) {
         arg.mode = GRN_OP_PARTIAL;
         if (arg.match_info) {
           if (arg.match_info->flags & GRN_MATCH_INFO_GET_MIN_RECORD_ID) {

  Modified: lib/proc/proc_select.c (+32 -7)
===================================================================
--- lib/proc/proc_select.c    2018-03-07 17:12:17 +0900 (49a5d996a)
+++ lib/proc/proc_select.c    2018-03-08 15:48:54 +0900 (6cc2def5a)
@@ -117,6 +117,7 @@ typedef struct {
   grn_raw_string cache;
   grn_raw_string match_escalation_threshold;
   grn_raw_string adjuster;
+  grn_raw_string match_escalation;
   grn_columns columns;
 
   /* for processing */
@@ -3031,7 +3032,8 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
   grn_content_type output_type = ctx->impl->output.type;
   char cache_key[GRN_CACHE_MAX_KEY_SIZE];
   uint32_t cache_key_size;
-  long long int threshold, original_threshold = 0;
+  long long int original_match_escalation_threshold = 0;
+  grn_bool original_force_match_escalation = GRN_FALSE;
   grn_cache *cache_obj = grn_cache_current_get(ctx);
 
   if (grn_ctx_get_command_version(ctx) < GRN_COMMAND_VERSION_3) {
@@ -3059,6 +3061,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
     data->filter.query_expander.length + 1 +
     data->filter.query_flags.length + 1 +
     data->adjuster.length + 1 +
+    data->match_escalation.length + 1 +
     sizeof(grn_content_type) +
     sizeof(int) * 2 +
     sizeof(grn_command_version) +
@@ -3170,6 +3173,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
     PUT_CACHE_KEY(data->filter.query_expander);
     PUT_CACHE_KEY(data->filter.query_flags);
     PUT_CACHE_KEY(data->adjuster);
+    PUT_CACHE_KEY(data->match_escalation);
     grn_memcpy(cp, &output_type, sizeof(grn_content_type));
     cp += sizeof(grn_content_type);
     grn_memcpy(cp, &(data->offset), sizeof(int));
@@ -3193,9 +3197,15 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
       }
     }
   }
-  if (data->match_escalation_threshold.length) {
+
+  original_match_escalation_threshold =
+    grn_ctx_get_match_escalation_threshold(ctx);
+  original_force_match_escalation =
+    grn_ctx_get_force_match_escalation(ctx);
+
+  if (data->match_escalation_threshold.length > 0) {
     const char *end, *rest;
-    original_threshold = grn_ctx_get_match_escalation_threshold(ctx);
+    long long int threshold;
     end =
       data->match_escalation_threshold.value +
       data->match_escalation_threshold.length;
@@ -3204,6 +3214,16 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
       grn_ctx_set_match_escalation_threshold(ctx, threshold);
     }
   }
+  if (data->match_escalation.length > 0) {
+    if (GRN_RAW_STRING_EQUAL_CSTRING(data->match_escalation, "auto")) {
+      grn_ctx_set_force_match_escalation(ctx, GRN_FALSE);
+    } else if (GRN_RAW_STRING_EQUAL_CSTRING(data->match_escalation, "yes")) {
+      grn_ctx_set_force_match_escalation(ctx, GRN_TRUE);
+    } else if (GRN_RAW_STRING_EQUAL_CSTRING(data->match_escalation, "no")) {
+      grn_ctx_set_force_match_escalation(ctx, GRN_FALSE);
+      grn_ctx_set_match_escalation_threshold(ctx, -1);
+    }
+  }
 
   data->tables.target = grn_ctx_get(ctx, data->table.value, data->table.length);
   if (!data->tables.target) {
@@ -3318,9 +3338,9 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
   }
 
 exit :
-  if (data->match_escalation_threshold.length > 0) {
-    grn_ctx_set_match_escalation_threshold(ctx, original_threshold);
-  }
+  grn_ctx_set_match_escalation_threshold(ctx,
+                                         original_match_escalation_threshold);
+  grn_ctx_set_force_match_escalation(ctx, original_force_match_escalation);
 
   /* GRN_LOG(ctx, GRN_LOG_NONE, "%d", ctx->seqno); */
 
@@ -3775,6 +3795,10 @@ command_select(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data
     grn_plugin_proc_get_var_string(ctx, user_data,
                                    "adjuster", -1,
                                    &(data.adjuster.length));
+  data.match_escalation.value =
+    grn_plugin_proc_get_var_string(ctx, user_data,
+                                   "match_escalation", -1,
+                                   &(data.match_escalation.length));
 
   if (!grn_select_data_fill_slices(ctx, user_data, &data)) {
     goto exit;
@@ -3844,7 +3868,7 @@ exit :
   return NULL;
 }
 
-#define N_VARS 27
+#define N_VARS 28
 #define DEFINE_VARS grn_expr_var vars[N_VARS]
 
 static void
@@ -3880,6 +3904,7 @@ init_vars(grn_ctx *ctx, grn_expr_var *vars)
   grn_plugin_expr_var_init(ctx, &(vars[24]), "sort_keys", -1);
   grn_plugin_expr_var_init(ctx, &(vars[25]), "drilldown_sort_keys", -1);
   grn_plugin_expr_var_init(ctx, &(vars[26]), "drilldown_adjuster", -1);
+  grn_plugin_expr_var_init(ctx, &(vars[27]), "match_escalation", -1);
 }
 
 void

  Modified: test/command/suite/select/filter/unary_operation/match_and_not_not_match.expected (+2 -2)
===================================================================
--- test/command/suite/select/filter/unary_operation/match_and_not_not_match.expected    2018-03-07 17:12:17 +0900 (2622fa18c)
+++ test/command/suite/select/filter/unary_operation/match_and_not_not_match.expected    2018-03-08 15:48:54 +0900 (9493a8242)
@@ -50,7 +50,7 @@ select Texts --filter '(_key @ "Rroonga") &! !(_key @ "Groonga")'
 #|i| [object][search][index][key][exact] <Terms.texts_key>
 #|i| grn_ii_sel > (Groonga)
 #|i| n=1 (Groonga)
-#|i| exact: 1
-#|i| hits=1
+#|i| exact: 2
+#|i| hits=2
 log_level --level notice
 [[0,0.0,0.0],true]

  Added: test/command/suite/select/match_escalation/auto.expected (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/match_escalation/auto.expected    2018-03-08 15:48:54 +0900 (3a077f328)
@@ -0,0 +1,53 @@
+table_create Memos TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Memos content COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+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 Memos content
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"content": "Groonga is fast"},
+{"content": "Groonga is the fastest"},
+{"content": "Groonga is faster"},
+{"content": "Groonga is not slow"}
+]
+[[0,0.0,0.0],4]
+select Memos   --filter 'content @ "fas"'   --match_escalation auto   --output_columns '*,_score'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        3
+      ],
+      [
+        [
+          "content",
+          "Text"
+        ],
+        [
+          "_score",
+          "Int32"
+        ]
+      ],
+      [
+        "Groonga is fast",
+        1
+      ],
+      [
+        "Groonga is the fastest",
+        1
+      ],
+      [
+        "Groonga is faster",
+        1
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/match_escalation/auto.test (+20 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/match_escalation/auto.test    2018-03-08 15:48:54 +0900 (7358c3934)
@@ -0,0 +1,20 @@
+table_create Memos TABLE_NO_KEY
+column_create Memos content COLUMN_SCALAR Text
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Terms index COLUMN_INDEX|WITH_POSITION Memos content
+
+load --table Memos
+[
+{"content": "Groonga is fast"},
+{"content": "Groonga is the fastest"},
+{"content": "Groonga is faster"},
+{"content": "Groonga is not slow"}
+]
+
+select Memos \
+  --filter 'content @ "fas"' \
+  --match_escalation auto \
+  --output_columns '*,_score'

  Added: test/command/suite/select/match_escalation/match_columns.expected (+71 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/match_escalation/match_columns.expected    2018-03-08 15:48:54 +0900 (62e0a777d)
@@ -0,0 +1,71 @@
+table_create Memos TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Memos title COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Memos content COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+table_create Terms TABLE_PAT_KEY ShortText   --default_tokenizer TokenBigram   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+column_create Terms title_index COLUMN_INDEX|WITH_POSITION Memos title
+[[0,0.0,0.0],true]
+column_create Terms content_index COLUMN_INDEX|WITH_POSITION Memos content
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"title": "Groonga1", "content": "Groonga is fast"},
+{"title": "Groonga2", "content": "Groonga is the fastest"},
+{"title": "Groonga3", "content": "Groonga is faster"},
+{"title": "Groonga4", "content": "Groonga is not slow"}
+]
+[[0,0.0,0.0],4]
+select Memos   --match_columns content,title   --query 'fas'   --filter '(true || true)'   --match_escalation yes   --output_columns '*,_score'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        3
+      ],
+      [
+        [
+          "content",
+          "Text"
+        ],
+        [
+          "title",
+          "ShortText"
+        ],
+        [
+          "_score",
+          "Int32"
+        ]
+      ],
+      [
+        "Groonga is fast",
+        "Groonga1",
+        4
+      ],
+      [
+        "Groonga is the fastest",
+        "Groonga2",
+        4
+      ],
+      [
+        "Groonga is faster",
+        "Groonga3",
+        4
+      ]
+    ]
+  ]
+]
+#>select --filter "(true || true)" --match_columns "content,title" --match_escalation "yes" --output_columns "*,_score" --query "fas" --table "Memos"
+#:000000000000000 filter(4): true
+#:000000000000000 filter(4): true
+#:000000000000000 filter(3): (match columns) match "fas"
+#:000000000000000 select(3)
+#:000000000000000 output(3)
+#<000000000000000 rc=0

  Added: test/command/suite/select/match_escalation/match_columns.test (+27 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/match_escalation/match_columns.test    2018-03-08 15:48:54 +0900 (7c04a93ce)
@@ -0,0 +1,27 @@
+table_create Memos TABLE_NO_KEY
+column_create Memos title COLUMN_SCALAR ShortText
+column_create Memos content COLUMN_SCALAR Text
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Terms title_index COLUMN_INDEX|WITH_POSITION Memos title
+column_create Terms content_index COLUMN_INDEX|WITH_POSITION Memos content
+
+load --table Memos
+[
+{"title": "Groonga1", "content": "Groonga is fast"},
+{"title": "Groonga2", "content": "Groonga is the fastest"},
+{"title": "Groonga3", "content": "Groonga is faster"},
+{"title": "Groonga4", "content": "Groonga is not slow"}
+]
+
+#$GRN_QUERY_LOG_SHOW_CONDITION=yes
+#@collect-query-log true
+select Memos \
+  --match_columns content,title \
+  --query 'fas' \
+  --filter '(true || true)' \
+  --match_escalation yes \
+  --output_columns '*,_score'
+#@collect-query-log false

  Added: test/command/suite/select/match_escalation/no.expected (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/match_escalation/no.expected    2018-03-08 15:48:54 +0900 (d44e8c6f7)
@@ -0,0 +1,18 @@
+table_create Memos TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Memos content COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+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 Memos content
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"content": "Groonga is fast"},
+{"content": "Groonga is the fastest"},
+{"content": "Groonga is faster"},
+{"content": "Groonga is not slow"}
+]
+[[0,0.0,0.0],4]
+select Memos   --filter 'content @ "fas"'   --match_escalation no   --output_columns '*,_score'
+[[0,0.0,0.0],[[[0],[["content","Text"],["_score","Int32"]]]]]

  Added: test/command/suite/select/match_escalation/no.test (+20 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/match_escalation/no.test    2018-03-08 15:48:54 +0900 (0d305a308)
@@ -0,0 +1,20 @@
+table_create Memos TABLE_NO_KEY
+column_create Memos content COLUMN_SCALAR Text
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Terms index COLUMN_INDEX|WITH_POSITION Memos content
+
+load --table Memos
+[
+{"content": "Groonga is fast"},
+{"content": "Groonga is the fastest"},
+{"content": "Groonga is faster"},
+{"content": "Groonga is not slow"}
+]
+
+select Memos \
+  --filter 'content @ "fas"' \
+  --match_escalation no \
+  --output_columns '*,_score'

  Added: test/command/suite/select/match_escalation/yes.expected (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/match_escalation/yes.expected    2018-03-08 15:48:54 +0900 (b7ac6bf5a)
@@ -0,0 +1,53 @@
+table_create Memos TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Memos content COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+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 Memos content
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"content": "Groonga is fast"},
+{"content": "Groonga is the fastest"},
+{"content": "Groonga is faster"},
+{"content": "Groonga is not slow"}
+]
+[[0,0.0,0.0],4]
+select Memos   --filter 'true && content @ "fas"'   --match_escalation yes   --output_columns '*,_score'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        3
+      ],
+      [
+        [
+          "content",
+          "Text"
+        ],
+        [
+          "_score",
+          "Int32"
+        ]
+      ],
+      [
+        "Groonga is fast",
+        3
+      ],
+      [
+        "Groonga is the fastest",
+        3
+      ],
+      [
+        "Groonga is faster",
+        3
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/match_escalation/yes.test (+20 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/match_escalation/yes.test    2018-03-08 15:48:54 +0900 (baaf16b36)
@@ -0,0 +1,20 @@
+table_create Memos TABLE_NO_KEY
+column_create Memos content COLUMN_SCALAR Text
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Terms index COLUMN_INDEX|WITH_POSITION Memos content
+
+load --table Memos
+[
+{"content": "Groonga is fast"},
+{"content": "Groonga is the fastest"},
+{"content": "Groonga is faster"},
+{"content": "Groonga is not slow"}
+]
+
+select Memos \
+  --filter 'true && content @ "fas"' \
+  --match_escalation yes \
+  --output_columns '*,_score'
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180308/b13a3715/attachment-0001.htm 



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