Navigation Menu

Skip to content

Commit

Permalink
[storage] don't normalize key for multiple column index.
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Sep 23, 2011
1 parent 050fb8c commit 815136f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ha_mroonga.cc
Expand Up @@ -1640,6 +1640,7 @@ int ha_mroonga::storage_create(const char *name, TABLE *table,
KEY key_info = table->s->key_info[i];

int key_parts = key_info.key_parts;
grn_obj_flags idx_tbl_flags = GRN_OBJ_PERSISTENT;
if (key_parts == 1) {
Field *field = key_info.key_part[0].field;
const char *column_name = field->field_name;
Expand All @@ -1654,6 +1655,7 @@ int ha_mroonga::storage_create(const char *name, TABLE *table,
int mysql_field_type = field->type();
grn_builtin_type groonga_type = mrn_get_type(ctx, mysql_field_type);
index_type = grn_ctx_at(ctx, groonga_type);
idx_tbl_flags |= GRN_OBJ_KEY_NORMALIZE;
} else {
index_type = grn_ctx_at(ctx, GRN_DB_SHORT_TEXT);
}
Expand All @@ -1664,13 +1666,12 @@ int ha_mroonga::storage_create(const char *name, TABLE *table,
GRN_OBJ_COLUMN_INDEX | GRN_OBJ_WITH_POSITION | GRN_OBJ_PERSISTENT;

int key_alg = key_info.algorithm;
grn_obj_flags idx_tbl_flags;
if (key_alg == HA_KEY_ALG_FULLTEXT) {
idx_tbl_flags = GRN_OBJ_TABLE_PAT_KEY | GRN_OBJ_PERSISTENT | GRN_OBJ_KEY_NORMALIZE;
idx_tbl_flags |= GRN_OBJ_TABLE_PAT_KEY;
} else if (key_alg == HA_KEY_ALG_HASH) {
idx_tbl_flags = GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_PERSISTENT | GRN_OBJ_KEY_NORMALIZE;
idx_tbl_flags |= GRN_OBJ_TABLE_HASH_KEY;
} else {
idx_tbl_flags = GRN_OBJ_TABLE_PAT_KEY | GRN_OBJ_PERSISTENT | GRN_OBJ_KEY_NORMALIZE;
idx_tbl_flags |= GRN_OBJ_TABLE_PAT_KEY;
}

idx_tbl_obj = grn_table_create(ctx, idx_name, strlen(idx_name), NULL,
Expand Down

0 comments on commit 815136f

Please sign in to comment.