Masafumi Yokoyama
null+****@clear*****
Thu Mar 12 15:04:39 JST 2015
Masafumi Yokoyama 2015-03-12 15:04:39 +0900 (Thu, 12 Mar 2015) New Revision: e0c98470a219485dced172653f39428ecd530dd9 https://github.com/groonga/groonga/commit/e0c98470a219485dced172653f39428ecd530dd9 Message: Fix score for 2-items descending by index of section Modified files: lib/expr.c Modified: lib/expr.c (+7 -1) =================================================================== --- lib/expr.c 2015-03-12 14:44:27 +0900 (2e03b83) +++ lib/expr.c 2015-03-12 15:04:39 +0900 (801e04c) @@ -5184,7 +5184,13 @@ grn_table_select_index(grn_ctx *ctx, grn_obj *table, scan_info *si, int32_t weight = wp[1]; if (sid) { int weight_index = sid - 1; - GRN_INT32_SET_AT(ctx, &wv, weight_index, weight); + int current_vector_size; + current_vector_size = GRN_BULK_VSIZE(&wv)/sizeof(int32_t); + if (weight_index < current_vector_size) { + *((int *)GRN_BULK_HEAD(&wv)) = weight; + } else { + GRN_INT32_SET_AT(ctx, &wv, weight_index, weight); + } optarg.weight_vector = &GRN_INT32_VALUE(&wv); optarg.vector_size = GRN_BULK_VSIZE(&wv)/sizeof(int32_t); } else { -------------- next part -------------- HTML����������������������������...Download