naoa
null+****@clear*****
Sat Feb 6 16:56:23 JST 2016
naoa 2016-02-06 16:56:23 +0900 (Sat, 06 Feb 2016) New Revision: 595c8348df48b09e4cf1818591d2cdde0c74c721 https://github.com/groonga/groonga/commit/595c8348df48b09e4cf1818591d2cdde0c74c721 Merged faaa0a0: Merge pull request #470 from naoa/fuzzy-fix-score Message: ii: change how to calculate fuzzy_search Modified files: lib/ii.c test/command/suite/select/function/fuzzy_search/index/index.expected test/command/suite/select/function/fuzzy_search/index/index_column.expected test/command/suite/select/function/fuzzy_search/index/index_with_tokenizer.expected Modified: lib/ii.c (+9 -3) =================================================================== --- lib/ii.c 2016-02-06 16:55:39 +0900 (7091f40) +++ lib/ii.c 2016-02-06 16:56:23 +0900 (b9e12f4) @@ -5601,21 +5601,27 @@ token_info_open(grn_ctx *ctx, grn_obj *lexicon, grn_ii *ii, } break; case EX_FUZZY : - if ((h = grn_hash_create(ctx, NULL, sizeof(grn_id), 0, 0))) { + if ((h = (grn_hash *)grn_table_create(ctx, NULL, 0, NULL, + GRN_OBJ_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC, + grn_ctx_at(ctx, GRN_DB_UINT32), NULL))) { grn_table_fuzzy_search(ctx, lexicon, key, key_size, args, (grn_obj *)h); if (GRN_HASH_SIZE(h)) { if ((ti->cursors = cursor_heap_open(ctx, GRN_HASH_SIZE(h)))) { - GRN_HASH_EACH(ctx, h, id, &tp, NULL, NULL, { + grn_rset_recinfo *ri; + GRN_HASH_EACH(ctx, h, id, &tp, NULL, (void **)&ri, { if ((s = grn_ii_estimate_size(ctx, ii, *tp))) { + grn_ii_cursor *ic; cursor_heap_push(ctx, ti->cursors, ii, *tp, 0); + ic = ti->cursors->bins[ti->cursors->n_entries - 1]; + ic->post->weight += ri->score - 1; ti->ntoken++; ti->size += s; } }); } } - grn_hash_close(ctx, h); + grn_obj_close(ctx, (grn_obj *)h); } break; } Modified: test/command/suite/select/function/fuzzy_search/index/index.expected (+1 -1) =================================================================== --- test/command/suite/select/function/fuzzy_search/index/index.expected 2016-02-06 16:55:39 +0900 (e5f53fb) +++ test/command/suite/select/function/fuzzy_search/index/index.expected 2016-02-06 16:56:23 +0900 (aa709fd) @@ -37,7 +37,7 @@ select Users --filter 'fuzzy_search(name, "Tom", 1)' --output_columns 'name, _ ], [ "Tom", - 1 + 2 ], [ "Tomy", Modified: test/command/suite/select/function/fuzzy_search/index/index_column.expected (+1 -1) =================================================================== --- test/command/suite/select/function/fuzzy_search/index/index_column.expected 2016-02-06 16:55:39 +0900 (1034c86) +++ test/command/suite/select/function/fuzzy_search/index/index_column.expected 2016-02-06 16:56:23 +0900 (1b2c507) @@ -37,7 +37,7 @@ select Users --filter 'fuzzy_search(Tags.tag, "Tom", 1)' --output_columns 'nam ], [ "Tom", - 1 + 2 ], [ "Tomy", Modified: test/command/suite/select/function/fuzzy_search/index/index_with_tokenizer.expected (+1 -1) =================================================================== --- test/command/suite/select/function/fuzzy_search/index/index_with_tokenizer.expected 2016-02-06 16:55:39 +0900 (e09ac56) +++ test/command/suite/select/function/fuzzy_search/index/index_with_tokenizer.expected 2016-02-06 16:56:23 +0900 (5700d51) @@ -37,7 +37,7 @@ select Users --filter 'fuzzy_search(name, "Tom Yamad", 1)' --output_columns 'n ], [ "Tom Yamada", - 1 + 2 ], [ "Tomy Yamada", -------------- next part -------------- HTML����������������������������... 下載