Kouhei Sutou
null+****@clear*****
Tue Feb 26 16:25:27 JST 2013
Kouhei Sutou 2013-02-26 16:25:27 +0900 (Tue, 26 Feb 2013) New Revision: 87f9d9050b651b92bc0f5010561857d847760a5e https://github.com/groonga/groonga/commit/87f9d9050b651b92bc0f5010561857d847760a5e Log: Support two or more indexes for a table key If there are two or more indexes for a table key, loading a new key to the talbe may crash. Added files: test/command/suite/load/index/online/key_twice.expected test/command/suite/load/index/online/key_twice.test Modified files: lib/db.c Modified: lib/db.c (+4 -4) =================================================================== --- lib/db.c 2013-02-26 11:29:22 +0900 (46e78f0) +++ lib/db.c 2013-02-26 16:25:27 +0900 (9c67af1) @@ -1108,11 +1108,11 @@ grn_table_add(grn_ctx *ctx, grn_obj *table, const void *key, unsigned int key_si GRN_TEXT_SET_REF(&value_, key, key_size); GRN_UINT32_SET(ctx, &id_, id); GRN_UINT32_SET(ctx, &flags_, GRN_OBJ_SET); - grn_ctx_push(ctx, &id_); - grn_ctx_push(ctx, &oldvalue_); - grn_ctx_push(ctx, &value_); - grn_ctx_push(ctx, &flags_); while (hooks) { + grn_ctx_push(ctx, &id_); + grn_ctx_push(ctx, &oldvalue_); + grn_ctx_push(ctx, &value_); + grn_ctx_push(ctx, &flags_); pctx.caller = NULL; pctx.currh = hooks; if (hooks->proc) { Added: test/command/suite/load/index/online/key_twice.expected (+19 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/load/index/online/key_twice.expected 2013-02-26 16:25:27 +0900 (f241cad) @@ -0,0 +1,19 @@ +table_create Users TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +table_create Index1 TABLE_PAT_KEY --key_type ShortText --default_tokenizer TokenBigramSplitSymbolAlpha +[[0,0.0,0.0],true] +column_create Index1 users_key COLUMN_INDEX Users _key +[[0,0.0,0.0],true] +table_create Index2 TABLE_PAT_KEY --key_type ShortText --default_tokenizer TokenBigramSplitSymbolAlpha +[[0,0.0,0.0],true] +column_create Index2 users_key COLUMN_INDEX Users _key +[[0,0.0,0.0],true] +load --table Users +[ +["_key"], +["Alice"], +["Bob"] +] +[[0,0.0,0.0],2] +select Users --match_columns "Index1.users_key * 10 || Index2.users_key * 5" --query "li" --output_columns _key,_score +[[0,0.0,0.0],[[[1],[["_key","ShortText"],["_score","Int32"]],["Alice",15]]]] Added: test/command/suite/load/index/online/key_twice.test (+21 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/load/index/online/key_twice.test 2013-02-26 16:25:27 +0900 (8d17521) @@ -0,0 +1,21 @@ +table_create Users TABLE_HASH_KEY ShortText + +table_create Index1 TABLE_PAT_KEY --key_type ShortText \ + --default_tokenizer TokenBigramSplitSymbolAlpha +column_create Index1 users_key COLUMN_INDEX Users _key + +table_create Index2 TABLE_PAT_KEY --key_type ShortText \ + --default_tokenizer TokenBigramSplitSymbolAlpha +column_create Index2 users_key COLUMN_INDEX Users _key + +load --table Users +[ +["_key"], +["Alice"], +["Bob"] +] + +select Users \ + --match_columns "Index1.users_key * 10 || Index2.users_key * 5" \ + --query "li" \ + --output_columns _key,_score -------------- next part -------------- HTML����������������������������...Descargar