[Groonga-commit] groonga/groonga at 933e476 [master] Add fuzzy_search() selector

Back to archive index

naoa null+****@clear*****
Fri Feb 5 09:10:09 JST 2016


naoa	2016-02-05 09:10:09 +0900 (Fri, 05 Feb 2016)

  New Revision: 933e476b7bf99ec258f734e6511a8a41e524f9aa
  https://github.com/groonga/groonga/commit/933e476b7bf99ec258f734e6511a8a41e524f9aa

  Merged a300aa1: Merge pull request #464 from naoa/master

  Message:
    Add fuzzy_search() selector
    
    it supports index or grn_pat only for now

  Added files:
    test/command/suite/select/function/fuzzy_search/index.expected
    test/command/suite/select/function/fuzzy_search/index.test
    test/command/suite/select/function/fuzzy_search/index_column.expected
    test/command/suite/select/function/fuzzy_search/index_column.test
    test/command/suite/select/function/fuzzy_search/index_with_tokenizer.expected
    test/command/suite/select/function/fuzzy_search/index_with_tokenizer.test
    test/command/suite/select/function/fuzzy_search/max_distance.expected
    test/command/suite/select/function/fuzzy_search/max_distance.test
    test/command/suite/select/function/fuzzy_search/max_expansion.expected
    test/command/suite/select/function/fuzzy_search/max_expansion.test
    test/command/suite/select/function/fuzzy_search/no_index.expected
    test/command/suite/select/function/fuzzy_search/no_index.test
    test/command/suite/select/function/fuzzy_search/pat.expected
    test/command/suite/select/function/fuzzy_search/pat.test
    test/command/suite/select/function/fuzzy_search/prefix_match_size.expected
    test/command/suite/select/function/fuzzy_search/prefix_match_size.test
    test/command/suite/select/function/fuzzy_search/transposition.expected
    test/command/suite/select/function/fuzzy_search/transposition.test
  Modified files:
    lib/proc.c

  Modified: lib/proc.c (+99 -0)
===================================================================
--- lib/proc.c    2016-02-05 07:32:15 +0900 (d219f73)
+++ lib/proc.c    2016-02-05 09:10:09 +0900 (f22d2d8)
@@ -6806,6 +6806,96 @@ exit :
   return rc;
 }
 
+static grn_rc
+selector_fuzzy_search(grn_ctx *ctx, grn_obj *table, grn_obj *index,
+                      int nargs, grn_obj **args,
+                      grn_obj *res, grn_operator op)
+{
+  grn_rc rc = GRN_SUCCESS;
+  grn_obj *target = NULL;
+  grn_obj *obj;
+  grn_obj *query;
+  uint32_t max_distance = 1;
+  uint32_t prefix_match_size = 0;
+  uint32_t max_expansion = 0;
+  int flags = 0;
+
+  if ((nargs - 1) < 2) {
+    ERR(GRN_INVALID_ARGUMENT,
+        "fuzzy_serach(): wrong number of arguments (%d ...)", nargs - 1);
+    rc = ctx->rc;
+    goto exit;
+  }
+  obj = args[1];
+  query = args[2];
+
+  if (nargs >= 4) {
+    max_distance = GRN_UINT32_VALUE(args[3]);
+  }
+  if (nargs >= 5) {
+    prefix_match_size = GRN_UINT32_VALUE(args[4]);
+  }
+  if (nargs >= 6) {
+    max_expansion = GRN_UINT32_VALUE(args[5]);
+  }
+  if (nargs == 7) {
+    if (GRN_BOOL_VALUE(args[6])) {
+      flags = GRN_TABLE_FUZZY_WITH_TRANSPOSITION;
+    }
+  }
+
+  if (index) {
+    target = index;
+  } else {
+    if (obj->header.type == GRN_COLUMN_INDEX) {
+      target = obj;
+    } else {
+      grn_column_index(ctx, obj, GRN_OP_FUZZY, &target, 1, NULL);
+    }
+    if (!target) {
+      if (grn_obj_is_key_accessor(ctx, obj) &&
+          table->header.type == GRN_TABLE_PAT_KEY) {
+         target = table;
+      }
+      /* TODO: support sequential fuzzy search */
+    }
+  }
+
+  if (!target) {
+    grn_obj inspected;
+    GRN_TEXT_INIT(&inspected, 0);
+    grn_inspect(ctx, &inspected, target);
+    ERR(GRN_INVALID_ARGUMENT,
+        "fuzzy_search(): column must be associated index"
+        " or column mast be COLUMN_INDEX or TABLE_PAT_KEY: <%.*s>",
+        (int)GRN_TEXT_LEN(&inspected),
+        GRN_TEXT_VALUE(&inspected));
+    rc = ctx->rc;
+    GRN_OBJ_FIN(ctx, &inspected);
+    goto exit;
+  } else {
+    grn_search_optarg options;
+    grn_fuzzy_optarg args;
+    options.mode = GRN_OP_FUZZY;
+    options.similarity_threshold = 0;
+    options.max_interval = 0;
+    options.weight_vector = NULL;
+    options.vector_size = 0;
+    options.proc = NULL;
+    options.max_size = 0;
+    options.scorer = NULL;
+    args.prefix_match_size = prefix_match_size;
+    args.max_distance = max_distance;
+    args.max_expansion = max_expansion;
+    args.flags = flags;
+    options.fuzzy_args = &args;
+    grn_obj_search(ctx, target, query, res, op, &options);
+  }
+
+exit :
+  return rc;
+}
+
 #define DEF_VAR(v,name_str) do {\
   (v).name = (name_str);\
   (v).name_size = GRN_STRLEN(name_str);\
@@ -7104,6 +7194,15 @@ grn_db_init_builtin_query(grn_ctx *ctx)
     grn_proc_set_selector(ctx, selector_proc, selector_prefix_rk_search);
   }
 
+  {
+    grn_obj *selector_proc;
+
+    selector_proc = grn_proc_create(ctx, "fuzzy_search", -1,
+                                    GRN_PROC_FUNCTION,
+                                    NULL, NULL, NULL, 0, NULL);
+    grn_proc_set_selector(ctx, selector_proc, selector_fuzzy_search);
+  }
+
   grn_proc_init_config_get(ctx);
   grn_proc_init_config_set(ctx);
   grn_proc_init_config_delete(ctx);

  Added: test/command/suite/select/function/fuzzy_search/index.expected (+48 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/index.expected    2016-02-05 09:10:09 +0900 (e5f53fb)
@@ -0,0 +1,48 @@
+table_create Users TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Tags tag COLUMN_INDEX Users name
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+[[0,0.0,0.0],3]
+select Users --filter 'fuzzy_search(name, "Tom", 1)'   --output_columns 'name, _score'   --match_escalation_threshold -1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "name",
+          "ShortText"
+        ],
+        [
+          "_score",
+          "Int32"
+        ]
+      ],
+      [
+        "Tom",
+        1
+      ],
+      [
+        "Tomy",
+        1
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/fuzzy_search/index.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/index.test    2016-02-05 09:10:09 +0900 (00142f4)
@@ -0,0 +1,16 @@
+table_create Users TABLE_NO_KEY
+column_create Users name COLUMN_SCALAR ShortText
+
+table_create Tags TABLE_PAT_KEY ShortText
+column_create Tags tag COLUMN_INDEX Users name
+
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+
+select Users --filter 'fuzzy_search(name, "Tom", 1)' \
+  --output_columns 'name, _score' \
+  --match_escalation_threshold -1

  Added: test/command/suite/select/function/fuzzy_search/index_column.expected (+48 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/index_column.expected    2016-02-05 09:10:09 +0900 (1034c86)
@@ -0,0 +1,48 @@
+table_create Users TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Tags tag COLUMN_INDEX Users name
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+[[0,0.0,0.0],3]
+select Users --filter 'fuzzy_search(Tags.tag, "Tom", 1)'   --output_columns 'name, _score'   --match_escalation_threshold -1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "name",
+          "ShortText"
+        ],
+        [
+          "_score",
+          "Int32"
+        ]
+      ],
+      [
+        "Tom",
+        1
+      ],
+      [
+        "Tomy",
+        1
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/fuzzy_search/index_column.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/index_column.test    2016-02-05 09:10:09 +0900 (50d4a0f)
@@ -0,0 +1,16 @@
+table_create Users TABLE_NO_KEY
+column_create Users name COLUMN_SCALAR ShortText
+
+table_create Tags TABLE_PAT_KEY ShortText
+column_create Tags tag COLUMN_INDEX Users name
+
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+
+select Users --filter 'fuzzy_search(Tags.tag, "Tom", 1)' \
+  --output_columns 'name, _score' \
+  --match_escalation_threshold -1

  Added: test/command/suite/select/function/fuzzy_search/index_with_tokenizer.expected (+48 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/index_with_tokenizer.expected    2016-02-05 09:10:09 +0900 (e09ac56)
@@ -0,0 +1,48 @@
+table_create Users TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit
+[[0,0.0,0.0],true]
+column_create Tags tag COLUMN_INDEX|WITH_POSITION Users name
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"name": "Tom Yamada"},
+{"name": "Tomy Yamada"},
+{"name": "Ken Yamada"}
+]
+[[0,0.0,0.0],3]
+select Users --filter 'fuzzy_search(name, "Tom Yamad", 1)'   --output_columns 'name, _score'   --match_escalation_threshold -1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "name",
+          "ShortText"
+        ],
+        [
+          "_score",
+          "Int32"
+        ]
+      ],
+      [
+        "Tom Yamada",
+        1
+      ],
+      [
+        "Tomy Yamada",
+        1
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/fuzzy_search/index_with_tokenizer.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/index_with_tokenizer.test    2016-02-05 09:10:09 +0900 (009761f)
@@ -0,0 +1,16 @@
+table_create Users TABLE_NO_KEY
+column_create Users name COLUMN_SCALAR ShortText
+
+table_create Tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit
+column_create Tags tag COLUMN_INDEX|WITH_POSITION Users name
+
+load --table Users
+[
+{"name": "Tom Yamada"},
+{"name": "Tomy Yamada"},
+{"name": "Ken Yamada"}
+]
+
+select Users --filter 'fuzzy_search(name, "Tom Yamad", 1)' \
+  --output_columns 'name, _score' \
+  --match_escalation_threshold -1

  Added: test/command/suite/select/function/fuzzy_search/max_distance.expected (+48 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/max_distance.expected    2016-02-05 09:10:09 +0900 (1c139b8)
@@ -0,0 +1,48 @@
+table_create Users TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Tags tag COLUMN_INDEX Users name
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+[[0,0.0,0.0],3]
+select Tags --filter 'fuzzy_search(_key, "To", 2)'   --output_columns '_key, _score'   --match_escalation_threshold -1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "_score",
+          "Int32"
+        ]
+      ],
+      [
+        "Tom",
+        1
+      ],
+      [
+        "Tomy",
+        2
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/fuzzy_search/max_distance.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/max_distance.test    2016-02-05 09:10:09 +0900 (2971d78)
@@ -0,0 +1,16 @@
+table_create Users TABLE_NO_KEY
+column_create Users name COLUMN_SCALAR ShortText
+
+table_create Tags TABLE_PAT_KEY ShortText
+column_create Tags tag COLUMN_INDEX Users name
+
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+
+select Tags --filter 'fuzzy_search(_key, "To", 2)' \
+  --output_columns '_key, _score' \
+  --match_escalation_threshold -1

  Added: test/command/suite/select/function/fuzzy_search/max_expansion.expected (+17 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/max_expansion.expected    2016-02-05 09:10:09 +0900 (accabe1)
@@ -0,0 +1,17 @@
+table_create Users TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Tags tag COLUMN_INDEX Users name
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+[[0,0.0,0.0],3]
+select Tags --filter 'fuzzy_search(_key, "To", 2, 0, 1)'   --output_columns '_key, _score'   --match_escalation_threshold -1
+[[0,0.0,0.0],[[[1],[["_key","ShortText"],["_score","Int32"]],["Tom",1]]]]

  Added: test/command/suite/select/function/fuzzy_search/max_expansion.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/max_expansion.test    2016-02-05 09:10:09 +0900 (14f5f4e1)
@@ -0,0 +1,16 @@
+table_create Users TABLE_NO_KEY
+column_create Users name COLUMN_SCALAR ShortText
+
+table_create Tags TABLE_PAT_KEY ShortText
+column_create Tags tag COLUMN_INDEX Users name
+
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+
+select Tags --filter 'fuzzy_search(_key, "To", 2, 0, 1)' \
+  --output_columns '_key, _score' \
+  --match_escalation_threshold -1

  Added: test/command/suite/select/function/fuzzy_search/no_index.expected (+26 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/no_index.expected    2016-02-05 09:10:09 +0900 (87b71b9)
@@ -0,0 +1,26 @@
+table_create Users TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+[[0,0.0,0.0],3]
+select Users --filter 'fuzzy_search(name, "Tom", 1)'   --output_columns 'name, _score'   --match_escalation_threshold -1
+[
+  [
+    [
+      -22,
+      0.0,
+      0.0
+    ],
+    "fuzzy_search(): column must be associated index or column mast be COLUMN_INDEX or TABLE_PAT_KEY: <(NULL)>"
+  ],
+  [
+
+  ]
+]
+#|e| fuzzy_search(): column must be associated index or column mast be COLUMN_INDEX or TABLE_PAT_KEY: <(NULL)>

  Added: test/command/suite/select/function/fuzzy_search/no_index.test (+13 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/no_index.test    2016-02-05 09:10:09 +0900 (a4aa0c1)
@@ -0,0 +1,13 @@
+table_create Users TABLE_NO_KEY
+column_create Users name COLUMN_SCALAR ShortText
+
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+
+select Users --filter 'fuzzy_search(name, "Tom", 1)' \
+  --output_columns 'name, _score' \
+  --match_escalation_threshold -1

  Added: test/command/suite/select/function/fuzzy_search/pat.expected (+48 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/pat.expected    2016-02-05 09:10:09 +0900 (80d3c7f)
@@ -0,0 +1,48 @@
+table_create Users TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Tags tag COLUMN_INDEX Users name
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+[[0,0.0,0.0],3]
+select Tags --filter 'fuzzy_search(_key, "Tom", 1)'   --output_columns '_key, _score'   --match_escalation_threshold -1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "_score",
+          "Int32"
+        ]
+      ],
+      [
+        "Tom",
+        0
+      ],
+      [
+        "Tomy",
+        1
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/fuzzy_search/pat.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/pat.test    2016-02-05 09:10:09 +0900 (5487475)
@@ -0,0 +1,16 @@
+table_create Users TABLE_NO_KEY
+column_create Users name COLUMN_SCALAR ShortText
+
+table_create Tags TABLE_PAT_KEY ShortText
+column_create Tags tag COLUMN_INDEX Users name
+
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+
+select Tags --filter 'fuzzy_search(_key, "Tom", 1)' \
+  --output_columns '_key, _score' \
+  --match_escalation_threshold -1

  Added: test/command/suite/select/function/fuzzy_search/prefix_match_size.expected (+48 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/prefix_match_size.expected    2016-02-05 09:10:09 +0900 (55c11d9)
@@ -0,0 +1,48 @@
+table_create Users TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Tags tag COLUMN_INDEX Users name
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+[[0,0.0,0.0],3]
+select Tags --filter 'fuzzy_search(_key, "To", 5, 1)'   --output_columns '_key, _score'   --match_escalation_threshold -1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "_score",
+          "Int32"
+        ]
+      ],
+      [
+        "Tom",
+        1
+      ],
+      [
+        "Tomy",
+        2
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/fuzzy_search/prefix_match_size.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/prefix_match_size.test    2016-02-05 09:10:09 +0900 (d757302)
@@ -0,0 +1,16 @@
+table_create Users TABLE_NO_KEY
+column_create Users name COLUMN_SCALAR ShortText
+
+table_create Tags TABLE_PAT_KEY ShortText
+column_create Tags tag COLUMN_INDEX Users name
+
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+
+select Tags --filter 'fuzzy_search(_key, "To", 5, 1)' \
+  --output_columns '_key, _score' \
+  --match_escalation_threshold -1

  Added: test/command/suite/select/function/fuzzy_search/transposition.expected (+48 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/transposition.expected    2016-02-05 09:10:09 +0900 (7f8b18d)
@@ -0,0 +1,48 @@
+table_create Users TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Tags tag COLUMN_INDEX Users name
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+[[0,0.0,0.0],3]
+select Tags --filter 'fuzzy_search(_key, "Toym", 1, 0, 0, true)'   --output_columns '_key, _score'   --match_escalation_threshold -1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "_score",
+          "Int32"
+        ]
+      ],
+      [
+        "Tom",
+        1
+      ],
+      [
+        "Tomy",
+        1
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/fuzzy_search/transposition.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/transposition.test    2016-02-05 09:10:09 +0900 (24c241e)
@@ -0,0 +1,16 @@
+table_create Users TABLE_NO_KEY
+column_create Users name COLUMN_SCALAR ShortText
+
+table_create Tags TABLE_PAT_KEY ShortText
+column_create Tags tag COLUMN_INDEX Users name
+
+load --table Users
+[
+{"name": "Tom"},
+{"name": "Tomy"},
+{"name": "Ken"}
+]
+
+select Tags --filter 'fuzzy_search(_key, "Toym", 1, 0, 0, true)' \
+  --output_columns '_key, _score' \
+  --match_escalation_threshold -1
-------------- next part --------------
HTML����������������������������...
Télécharger 



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