Navigation Menu

Skip to content

Commit

Permalink
Use "grn_obj_is_index_column()" for decision whether index column or …
Browse files Browse the repository at this point in the history
…not.
  • Loading branch information
komainu8 committed Jun 20, 2018
1 parent db18220 commit f70094c
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions lib/db.c
Expand Up @@ -8827,34 +8827,35 @@ grn_obj_set_info_source_validate(grn_ctx *ctx, grn_obj *obj, grn_obj *value)

source_ids = (grn_id *)GRN_BULK_HEAD(value);
n_source_ids = GRN_BULK_VSIZE(value) / sizeof(grn_id);
if (n_source_ids == 1) {
grn_obj *source;
if (grn_obj_is_index_column(ctx, obj)) {
if (n_source_ids == 1) {
grn_obj *source;

source = grn_ctx_at(ctx, source_ids[0]);
switch (source->header.type) {
case GRN_COLUMN_VAR_SIZE :
switch (source->header.flags & GRN_OBJ_COLUMN_TYPE_MASK) {
case GRN_OBJ_COLUMN_VECTOR :
if ((obj->header.flags & GRN_OBJ_COLUMN_INDEX)
&& (obj->header.flags & GRN_OBJ_WITH_POSITION)
&& (lexicon_have_tokenizer)) {
if (!(obj->header.flags & GRN_OBJ_WITH_SECTION)) {
char index_name[GRN_TABLE_MAX_KEY_SIZE];
int index_name_size;
index_name_size = grn_obj_name(ctx, obj,
index_name, GRN_TABLE_MAX_KEY_SIZE);
ERR(GRN_INVALID_ARGUMENT,
"grn_obj_set_info(): GRN_INFO_SOURCE: "
"full text index for vector column must be created with WITH_SECTION flag: <%.*s>",
index_name_size, index_name);
goto exit;
source = grn_ctx_at(ctx, source_ids[0]);
switch (source->header.type) {
case GRN_COLUMN_VAR_SIZE :
switch (source->header.flags & GRN_OBJ_COLUMN_TYPE_MASK) {
case GRN_OBJ_COLUMN_VECTOR :
if ((obj->header.flags & GRN_OBJ_WITH_POSITION)
&& (lexicon_have_tokenizer)) {
if (!(obj->header.flags & GRN_OBJ_WITH_SECTION)) {
char index_name[GRN_TABLE_MAX_KEY_SIZE];
int index_name_size;
index_name_size = grn_obj_name(ctx, obj,
index_name, GRN_TABLE_MAX_KEY_SIZE);
ERR(GRN_INVALID_ARGUMENT,
"grn_obj_set_info(): GRN_INFO_SOURCE: "
"full text index for vector column must be created with WITH_SECTION flag: <%.*s>",
index_name_size, index_name);
goto exit;
}
}
default:
break;
}
default:
break;
}
default:
break;
}
}

Expand Down

0 comments on commit f70094c

Please sign in to comment.