[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:52:03 JST


Kouhei Sutou	2011-08-14 13:52:03 +0000 (Sun, 14 Aug 2011)

  New Revision: f045b5f2d03747ce318cfb8fd699c54866b55028

  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:37:23 +0000 (d2887a0)
+++ plugins/suggest/suggest.c    2011-08-14 13:52:03 +0000 (1cf80a1)
@@ -218,7 +218,8 @@ complete(grn_ctx *ctx, grn_obj *items, grn_obj *items_boost, grn_obj *col,
                     void *value;
                     int32_t score;
                     grn_rset_recinfo *ri;
-                    score = GRN_INT32_VALUE(&item_freq) +
+                    score = 1 +
+                            GRN_INT32_VALUE(&item_freq) +
                             GRN_INT32_VALUE(&item_boost);
                     if (score >= threshold) {
                       grn_hash_add(ctx, (grn_hash *)res,

  Modified: test/unit/story/test-rurema.c (+8 -8)
===================================================================
--- test/unit/story/test-rurema.c    2011-08-14 13:37:23 +0000 (bdf614c)
+++ test/unit/story/test-rurema.c    2011-08-14 13:52:03 +0000 (59874ce)
@@ -106,10 +106,10 @@ data_complete_prefix_rk_search(void)
                  "query", G_TYPE_STRING, query, \
                  NULL)
 
-  ADD_DATUM("romaji", "tan");
-  ADD_DATUM("katakana", "タン");
-  ADD_DATUM("hiragana", "たん");
-  ADD_DATUM("hiragana + romaji", "たn");
+  ADD_DATUM("romaji", "saku");
+  ADD_DATUM("katakana", "サク");
+  ADD_DATUM("hiragana", "さく");
+  ADD_DATUM("hiragana + romaji", "さk");
 
 #undef ADD_DATUM
 }
@@ -122,7 +122,7 @@ test_complete_prefix_rk_search(gconstpointer data)
      "[[1],"
       "[[\"_key\",\"ShortText\"],"
        "[\"_score\",\"Int32\"]],"
-      "[\"短縮\",1]]}",
+      "[\"削除\",1]]}",
     send_command(
       cut_take_printf(
         "suggest "
@@ -142,13 +142,13 @@ test_complete_prefix_rk_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 'hen'"));
 }
 
@@ -165,7 +165,7 @@ test_complete_prefix_rk_search_threshold_not_fuond(void)
       "--table item_rurema "
       "--column kana "
       "--types complete "
-      "--threshold 101 "
+      "--threshold 102 "
       "--query 'hen'"));
 }
 




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