Kouhei Sutou
null+****@clear*****
Mon Jan 19 12:45:02 JST 2015
Kouhei Sutou 2015-01-19 12:45:02 +0900 (Mon, 19 Jan 2015) New Revision: 1926ac91d29bb356ff89edca842086ccc0a0cf03 https://github.com/groonga/groonga/commit/1926ac91d29bb356ff89edca842086ccc0a0cf03 Message: Fix a bug that 'index[0]' only match_columns doesn't use section ID Added files: test/command/suite/select/match_columns/section/by_index/single.expected test/command/suite/select/match_columns/section/by_index/single.test Modified files: lib/expr.c Modified: lib/expr.c (+3 -3) =================================================================== --- lib/expr.c 2015-01-19 12:38:37 +0900 (76181b0) +++ lib/expr.c 2015-01-19 12:45:02 +0900 (cd3e743) @@ -4641,7 +4641,7 @@ scan_info_build_find_index_column_index(grn_ctx *ctx, int32_t weight = 0; index = ec->value; - if (n_rest_codes > 2 && + if (n_rest_codes >= 2 && ec[1].value && (ec[1].value->header.domain == GRN_DB_INT32 || ec[1].value->header.domain == GRN_DB_UINT32) && @@ -4652,9 +4652,9 @@ scan_info_build_find_index_column_index(grn_ctx *ctx, sid = GRN_UINT32_VALUE(ec[1].value) + 1; } offset = 2; + } + if ((n_rest_codes - offset) >= 1) { weight = get_weight(ctx, ec + offset); - } else { - weight = get_weight(ctx, ec); } scan_info_put_index(ctx, si, index, sid, weight); Added: test/command/suite/select/match_columns/section/by_index/single.expected (+54 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/match_columns/section/by_index/single.expected 2015-01-19 12:45:02 +0900 (43cf195) @@ -0,0 +1,54 @@ +table_create Memos TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Memos title COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Memos content COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +table_create Lexicon TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram +[[0,0.0,0.0],true] +column_create Lexicon memo_index COLUMN_INDEX|WITH_POSITION|WITH_SECTION Memos title,content +[[0,0.0,0.0],true] +load --table Memos +[ +["title", "content"], +["groonga", "Start groonga!"], +["mroonga", "Start mroonga!"], +["rroonga", "Start rroonga!"], +["Ruby", "Start Ruby!"], +["learn", "Learning Ruby and groonga..."] +] +[[0,0.0,0.0],5] +select Memos --match_columns "Lexicon.memo_index[0]" --query Ruby --output_columns "title, content, _score" +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 1 + ], + [ + [ + "title", + "ShortText" + ], + [ + "content", + "ShortText" + ], + [ + "_score", + "Int32" + ] + ], + [ + "Ruby", + "Start Ruby!", + 1 + ] + ] + ] +] Added: test/command/suite/select/match_columns/section/by_index/single.test (+22 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/match_columns/section/by_index/single.test 2015-01-19 12:45:02 +0900 (6a0b092) @@ -0,0 +1,22 @@ +table_create Memos TABLE_NO_KEY +column_create Memos title COLUMN_SCALAR ShortText +column_create Memos content COLUMN_SCALAR ShortText + +table_create Lexicon TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram +column_create Lexicon memo_index COLUMN_INDEX|WITH_POSITION|WITH_SECTION \ + Memos title,content + +load --table Memos +[ +["title", "content"], +["groonga", "Start groonga!"], +["mroonga", "Start mroonga!"], +["rroonga", "Start rroonga!"], +["Ruby", "Start Ruby!"], +["learn", "Learning Ruby and groonga..."] +] + +select Memos \ + --match_columns "Lexicon.memo_index[0]" \ + --query Ruby \ + --output_columns "title, content, _score" -------------- next part -------------- HTML����������������������������... 下载