[Groonga-commit] groonga/groonga at e8872b8 [master] fuzzy_search: use selected table if operator is GRN_OP_AND

Back to archive index

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


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

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

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

  Message:
    fuzzy_search: use selected table if operator is GRN_OP_AND

  Added files:
    test/command/suite/select/function/fuzzy_search/sequential/and.expected
    test/command/suite/select/function/fuzzy_search/sequential/and.test
  Modified files:
    lib/proc.c

  Modified: lib/proc.c (+11 -3)
===================================================================
--- lib/proc.c    2016-02-05 13:46:10 +0900 (ecf7edf)
+++ lib/proc.c    2016-02-05 14:57:09 +0900 (cec8a6f)
@@ -7096,9 +7096,17 @@ selector_fuzzy_search(grn_ctx *ctx, grn_obj *table, grn_obj *index,
     if (!hash) {
       return GRN_NO_MEMORY_AVAILABLE;
     }
-    rc = sequential_fuzzy_search(ctx, table, obj, query,
-                                 max_distance, prefix_match_size,
-                                 max_expansion, flags, hash);
+
+    if (op == GRN_OP_AND) {
+      rc = sequential_fuzzy_search(ctx, res, obj, query,
+                                   max_distance, prefix_match_size,
+                                   max_expansion, flags, hash);
+    } else {
+      rc = sequential_fuzzy_search(ctx, table, obj, query,
+                                   max_distance, prefix_match_size,
+                                   max_expansion, flags, hash);
+    }
+
     if (rc == GRN_SUCCESS) {
       rc = grn_table_setoperation(ctx, res, hash, res, op);
     }

  Added: test/command/suite/select/function/fuzzy_search/sequential/and.expected (+13 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/sequential/and.expected    2016-02-05 14:57:09 +0900 (964cb6c)
@@ -0,0 +1,13 @@
+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 'name @^ "T" && fuzzy_search(name, "To", 1)'   --output_columns 'name, _score'   --match_escalation_threshold -1
+[[0,0.0,0.0],[[[1],[["name","ShortText"],["_score","Int32"]],["Tom",2]]]]

  Added: test/command/suite/select/function/fuzzy_search/sequential/and.test (+13 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/fuzzy_search/sequential/and.test    2016-02-05 14:57:09 +0900 (f74d6ab)
@@ -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 'name @^ "T" && fuzzy_search(name, "To", 1)' \
+  --output_columns 'name, _score' \
+  --match_escalation_threshold -1
-------------- next part --------------
HTML����������������������������...
다운로드 



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