[Groonga-commit] groonga/groonga [master] [suggest][complete] add '1' score for prefix search.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 8月 14日 (日) 22:56:34 JST


Kouhei Sutou	2011-08-14 13:56:34 +0000 (Sun, 14 Aug 2011)

  New Revision: 142480098197b693eb485024bddca6b0086fad80

  Log:
    [suggest][complete] add '1' score for prefix search.

  Modified files:
    plugins/suggest/suggest.c
    test/unit/story/test-rurema.c

  Modified: plugins/suggest/suggest.c (+2 -1)
===================================================================
--- plugins/suggest/suggest.c    2011-08-14 13:55:51 +0000 (e63511a)
+++ plugins/suggest/suggest.c    2011-08-14 13:56:34 +0000 (ff66788)
@@ -256,7 +256,8 @@ complete(grn_ctx *ctx, grn_obj *items, grn_obj *items_boost, grn_obj *col,
           if (GRN_INT32_VALUE(&item_boost) >= 0) {
             void *value;
             int32_t score;
-            score = GRN_INT32_VALUE(&item_freq) +
+            score = 1 +
+                    GRN_INT32_VALUE(&item_freq) +
                     GRN_INT32_VALUE(&item_boost);
             if (score >= threshold) {
               grn_rset_recinfo *ri;

  Modified: test/unit/story/test-rurema.c (+6 -6)
===================================================================
--- test/unit/story/test-rurema.c    2011-08-14 13:55:51 +0000 (6d74090)
+++ test/unit/story/test-rurema.c    2011-08-14 13:56:34 +0000 (dd39aff)
@@ -199,14 +199,14 @@ test_complete_prefix_search_force(void)
      "[[1],"
       "[[\"_key\",\"ShortText\"],"
        "[\"_score\",\"Int32\"]],"
-      "[\"置換\",0]]}",
+      "[\"置換\",1]]}",
     send_command(
       "suggest "
       "--table item_rurema "
       "--column kana "
       "--types complete "
       "--prefix_search yes "
-      "--threshold 0 "
+      "--threshold 1 "
       "--query '置'"));
 }
 
@@ -224,7 +224,7 @@ test_complete_prefix_search_disable(void)
       "--column kana "
       "--types complete "
       "--prefix_search no "
-      "--threshold -1 "
+      "--threshold 1 "
       "--query '置'"));
 }
 
@@ -236,13 +236,13 @@ test_complete_prefix_search_threshold_found(void)
      "[[1],"
       "[[\"_key\",\"ShortText\"],"
        "[\"_score\",\"Int32\"]],"
-      "[\"変数\",100]]}",
+      "[\"変数\",101]]}",
     send_command(
       "suggest "
       "--table item_rurema "
       "--column kana "
       "--types complete "
-      "--threshold 100 "
+      "--threshold 101 "
       "--query '変'"));
 }
 
@@ -259,7 +259,7 @@ test_complete_prefix_search_threshold_not_fuond(void)
       "--table item_rurema "
       "--column kana "
       "--types complete "
-      "--threshold 101 "
+      "--threshold 102 "
       "--query '変'"));
 }
 




Groonga-commit メーリングリストの案内
Back to archive index