[Groonga-commit] groonga/groonga at c26a43d [master] pat_fuzzy_search: change how to calculate score

Back to archive index

naoa null+****@clear*****
Sat Feb 6 16:55:39 JST 2016


naoa	2016-02-06 16:55:39 +0900 (Sat, 06 Feb 2016)

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

  Merged faaa0a0: Merge pull request #470 from naoa/fuzzy-fix-score

  Message:
    pat_fuzzy_search: change how to calculate score
    
    max_distance - edit_distance + 1

  Modified files:
    lib/pat.c
    test/command/suite/select/function/fuzzy_search/pat/max_distance.expected
    test/command/suite/select/function/fuzzy_search/pat/max_expansion.expected
    test/command/suite/select/function/fuzzy_search/pat/pat.expected
    test/command/suite/select/function/fuzzy_search/pat/prefix_length.expected
    test/command/suite/select/function/fuzzy_search/pat/prefix_length_ja.expected

  Modified: lib/pat.c (+1 -1)
===================================================================
--- lib/pat.c    2016-02-05 22:41:43 +0900 (fed5323)
+++ lib/pat.c    2016-02-06 16:55:39 +0900 (3707d11)
@@ -1517,7 +1517,7 @@ grn_pat_fuzzy_search(grn_ctx *ctx, grn_pat *pat,
     if (DB_OBJ(h)->header.flags & GRN_OBJ_WITH_SUBREC) {
       grn_rset_recinfo *ri;
       if (grn_hash_add(ctx, h, &(heap->nodes[i].id), sizeof(grn_id), (void **)&ri, NULL)) {
-        ri->score = heap->nodes[i].distance;
+        ri->score = max_distance - heap->nodes[i].distance + 1;
       }
     } else {
       grn_hash_add(ctx, h, &(heap->nodes[i].id), sizeof(grn_id), NULL, NULL);

  Modified: test/command/suite/select/function/fuzzy_search/pat/max_distance.expected (+2 -2)
===================================================================
--- test/command/suite/select/function/fuzzy_search/pat/max_distance.expected    2016-02-05 22:41:43 +0900 (1c139b8)
+++ test/command/suite/select/function/fuzzy_search/pat/max_distance.expected    2016-02-06 16:55:39 +0900 (fc844eb)
@@ -37,11 +37,11 @@ select Tags --filter 'fuzzy_search(_key, "To", 2)'   --output_columns '_key, _sc
       ],
       [
         "Tom",
-        1
+        2
       ],
       [
         "Tomy",
-        2
+        1
       ]
     ]
   ]

  Modified: test/command/suite/select/function/fuzzy_search/pat/max_expansion.expected (+1 -1)
===================================================================
--- test/command/suite/select/function/fuzzy_search/pat/max_expansion.expected    2016-02-05 22:41:43 +0900 (accabe1)
+++ test/command/suite/select/function/fuzzy_search/pat/max_expansion.expected    2016-02-06 16:55:39 +0900 (5bfc810)
@@ -14,4 +14,4 @@ load --table Users
 ]
 [[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]]]]
+[[0,0.0,0.0],[[[1],[["_key","ShortText"],["_score","Int32"]],["Tom",2]]]]

  Modified: test/command/suite/select/function/fuzzy_search/pat/pat.expected (+1 -1)
===================================================================
--- test/command/suite/select/function/fuzzy_search/pat/pat.expected    2016-02-05 22:41:43 +0900 (80d3c7f)
+++ test/command/suite/select/function/fuzzy_search/pat/pat.expected    2016-02-06 16:55:39 +0900 (41c531f)
@@ -37,7 +37,7 @@ select Tags --filter 'fuzzy_search(_key, "Tom", 1)'   --output_columns '_key, _s
       ],
       [
         "Tom",
-        0
+        2
       ],
       [
         "Tomy",

  Modified: test/command/suite/select/function/fuzzy_search/pat/prefix_length.expected (+2 -2)
===================================================================
--- test/command/suite/select/function/fuzzy_search/pat/prefix_length.expected    2016-02-05 22:41:43 +0900 (55c11d9)
+++ test/command/suite/select/function/fuzzy_search/pat/prefix_length.expected    2016-02-06 16:55:39 +0900 (18df7a4)
@@ -37,11 +37,11 @@ select Tags --filter 'fuzzy_search(_key, "To", 5, 1)'   --output_columns '_key,
       ],
       [
         "Tom",
-        1
+        5
       ],
       [
         "Tomy",
-        2
+        4
       ]
     ]
   ]

  Modified: test/command/suite/select/function/fuzzy_search/pat/prefix_length_ja.expected (+2 -2)
===================================================================
--- test/command/suite/select/function/fuzzy_search/pat/prefix_length_ja.expected    2016-02-05 22:41:43 +0900 (39ee32d)
+++ test/command/suite/select/function/fuzzy_search/pat/prefix_length_ja.expected    2016-02-06 16:55:39 +0900 (191afa7)
@@ -37,11 +37,11 @@ select Tags --filter 'fuzzy_search(_key, "とむ", 5, 1)'   --output_columns '_k
       ],
       [
         "とむ",
-        0
+        6
       ],
       [
         "とみー",
-        2
+        4
       ]
     ]
   ]
-------------- next part --------------
HTML����������������������������...
下載 



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