Kouhei Sutou
null+****@clear*****
Mon May 22 09:32:57 JST 2017
Kouhei Sutou 2017-05-22 09:32:57 +0900 (Mon, 22 May 2017) New Revision: 567014d9c578bd4debb8d776cdf443deff51265e https://github.com/groonga/groonga/commit/567014d9c578bd4debb8d776cdf443deff51265e Message: vector_slice: fix a bug that reference vector can't be detected It's introduced by 6d460140176dfb5c348820963bda11dbb114c5e9. Modified files: plugins/functions/vector.c Modified: plugins/functions/vector.c (+56 -49) =================================================================== --- plugins/functions/vector.c 2017-05-22 09:09:42 +0900 (d9f4017) +++ plugins/functions/vector.c 2017-05-22 09:32:57 +0900 (a7283fc) @@ -259,55 +259,62 @@ func_vector_slice(grn_ctx *ctx, int n_args, grn_obj **args, } break; case GRN_UVECTOR : - if (grn_obj_is_reference_column(ctx, target)) { - unsigned int i; - for (i = from; i < to; i++) { - grn_id id; - unsigned int weight; - id = grn_uvector_get_element(ctx, target, i, &weight); - grn_uvector_add_element(ctx, slice, id, weight); - } - } else { -#define PUT_SLICE_VALUES(type) do { \ - unsigned int i; \ - for (i = from; i < to; i++) { \ - GRN_ ## type ## _PUT(ctx, slice, GRN_ ## type ## _VALUE_AT(target, i)); \ - } \ - } while (GRN_FALSE) - switch (target->header.domain) { - case GRN_DB_BOOL : - PUT_SLICE_VALUES(BOOL); - break; - case GRN_DB_INT8 : - PUT_SLICE_VALUES(INT8); - break; - case GRN_DB_UINT8 : - PUT_SLICE_VALUES(UINT8); - break; - case GRN_DB_INT16 : - PUT_SLICE_VALUES(INT16); - break; - case GRN_DB_UINT16 : - PUT_SLICE_VALUES(UINT16); - break; - case GRN_DB_INT32 : - PUT_SLICE_VALUES(INT32); - break; - case GRN_DB_UINT32 : - PUT_SLICE_VALUES(UINT32); - break; - case GRN_DB_INT64 : - PUT_SLICE_VALUES(INT64); - break; - case GRN_DB_UINT64 : - PUT_SLICE_VALUES(UINT64); - break; - case GRN_DB_FLOAT : - PUT_SLICE_VALUES(FLOAT); - break; - case GRN_DB_TIME : - PUT_SLICE_VALUES(TIME); - break; + { + grn_obj *domain; + + domain = grn_ctx_at(ctx, target->header.domain); + if (grn_obj_is_table(ctx, domain)) { + unsigned int i; + for (i = from; i < to; i++) { + grn_id id; + unsigned int weight; + id = grn_uvector_get_element(ctx, target, i, &weight); + grn_uvector_add_element(ctx, slice, id, weight); + } + } else { +#define PUT_SLICE_VALUES(type) do { \ + unsigned int i; \ + for (i = from; i < to; i++) { \ + GRN_ ## type ## _PUT(ctx, \ + slice, \ + GRN_ ## type ## _VALUE_AT(target, i)); \ + } \ + } while (GRN_FALSE) + switch (target->header.domain) { + case GRN_DB_BOOL : + PUT_SLICE_VALUES(BOOL); + break; + case GRN_DB_INT8 : + PUT_SLICE_VALUES(INT8); + break; + case GRN_DB_UINT8 : + PUT_SLICE_VALUES(UINT8); + break; + case GRN_DB_INT16 : + PUT_SLICE_VALUES(INT16); + break; + case GRN_DB_UINT16 : + PUT_SLICE_VALUES(UINT16); + break; + case GRN_DB_INT32 : + PUT_SLICE_VALUES(INT32); + break; + case GRN_DB_UINT32 : + PUT_SLICE_VALUES(UINT32); + break; + case GRN_DB_INT64 : + PUT_SLICE_VALUES(INT64); + break; + case GRN_DB_UINT64 : + PUT_SLICE_VALUES(UINT64); + break; + case GRN_DB_FLOAT : + PUT_SLICE_VALUES(FLOAT); + break; + case GRN_DB_TIME : + PUT_SLICE_VALUES(TIME); + break; + } } } break; -------------- next part -------------- HTML����������������������������...Descargar