Kouhei Sutou
null+****@clear*****
Thu Apr 19 16:28:25 JST 2018
Kouhei Sutou 2018-04-19 16:28:25 +0900 (Thu, 19 Apr 2018) New Revision: e8203c5fe805fcb4d2aebab3a6fdc5b628d27178 https://github.com/groonga/groonga/commit/e8203c5fe805fcb4d2aebab3a6fdc5b628d27178 Message: Fix a bug that wrong scorer may be used It's caused when multiple scorers are used. Copied files: test/command/suite/select/match_columns/scorer/multiple/all.expected (from test/command/suite/select/match_columns/scorer/multiple.expected) test/command/suite/select/match_columns/scorer/multiple/all.test (from test/command/suite/select/match_columns/scorer/multiple.test) Modified files: lib/expr.c Renamed files: test/command/suite/select/match_columns/scorer/multiple/mixed.expected (from test/command/suite/select/match_columns/scorer/multiple.expected) test/command/suite/select/match_columns/scorer/multiple/mixed.test (from test/command/suite/select/match_columns/scorer/multiple.test) Modified: lib/expr.c (+4 -1) =================================================================== --- lib/expr.c 2018-04-19 15:55:18 +0900 (20e360f7c) +++ lib/expr.c 2018-04-19 16:28:25 +0900 (59d8cefb1) @@ -6424,7 +6424,10 @@ grn_table_select_index_match(grn_ctx *ctx, optarg.scorer_args_expr_offset = GRN_UINT32_VALUE_AT(&(si->scorer_args_expr_offsets), j); if (j < n_indexes - 1) { - if (sid && ip[0] == ip[1] && !optarg.scorer) { + if (sid && + ip[0] == ip[1] && + !optarg.scorer && + !GRN_PTR_VALUE_AT(&(si->scorers), j + 1)) { continue; } } Copied: test/command/suite/select/match_columns/scorer/multiple/all.expected (+0 -0) 100% =================================================================== Copied: test/command/suite/select/match_columns/scorer/multiple/all.test (+0 -0) 100% =================================================================== Renamed: test/command/suite/select/match_columns/scorer/multiple/mixed.expected (+3 -3) 83% =================================================================== --- test/command/suite/select/match_columns/scorer/multiple.expected 2018-04-19 15:55:18 +0900 (49811f897) +++ test/command/suite/select/match_columns/scorer/multiple/mixed.expected 2018-04-19 16:28:25 +0900 (f07a28a75) @@ -17,7 +17,7 @@ load --table Memos ["Ruby Ruby Ruby", "Ruby Ruby Ruby Ruby Ruby"] ] [[0,0.0,0.0],4] -select Memos --match_columns 'scorer_tf_at_most(title, 2.0) || scorer_tf_at_most(content, 3.0)' --query 'groonga' --output_columns "_score, title, content" --sortby -_score +select Memos --match_columns 'title || scorer_tf_at_most(content, 2.0)' --query 'groonga' --output_columns "_score, title, content" --sortby -_score [ [ 0, @@ -44,12 +44,12 @@ select Memos --match_columns 'scorer_tf_at_most(title, 2.0) || ] ], [ - 5, + 4, "Groonga Groonga", "Groonga Groonga Groonga Groonga" ], [ - 3, + 4, "Groonga Groonga Groonga", "Groonga" ], Renamed: test/command/suite/select/match_columns/scorer/multiple/mixed.test (+2 -2) 85% =================================================================== --- test/command/suite/select/match_columns/scorer/multiple.test 2018-04-19 15:55:18 +0900 (e8ffc2cfa) +++ test/command/suite/select/match_columns/scorer/multiple/mixed.test 2018-04-19 16:28:25 +0900 (84b9a53c8) @@ -18,8 +18,8 @@ load --table Memos ] select Memos \ - --match_columns 'scorer_tf_at_most(title, 2.0) || \ - scorer_tf_at_most(content, 3.0)' \ + --match_columns 'title || \ + scorer_tf_at_most(content, 2.0)' \ --query 'groonga' \ --output_columns "_score, title, content" \ --sortby -_score -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180419/60aadd31/attachment-0001.htm