Kouhei Sutou
null+****@clear*****
Sun Feb 18 16:52:11 JST 2018
Kouhei Sutou 2018-02-18 16:52:11 +0900 (Sun, 18 Feb 2018) New Revision: cf5e2554a8b1f08ff37652cd8302907242fc89d6 https://github.com/groonga/groonga/commit/cf5e2554a8b1f08ff37652cd8302907242fc89d6 Message: ii offline: fix a wrong index constructed bug It's caused only when vector column is a source and WITH_SECTION isn't specified. Added files: test/command/suite/load/index/offline/vector_text_without_section.expected test/command/suite/load/index/offline/vector_text_without_section.test test/command/suite/load/index/online/vector/text_without_section.expected test/command/suite/load/index/online/vector/text_without_section.test Modified files: lib/ii.c Modified: lib/ii.c (+2 -1) =================================================================== --- lib/ii.c 2018-02-18 13:59:24 +0900 (4f292a718) +++ lib/ii.c 2018-02-18 16:52:11 +0900 (e56116ff5) @@ -12317,7 +12317,8 @@ grn_ii_builder_append_obj(grn_ctx *ctx, grn_ii_builder *builder, if (sec->length == 0) { continue; } - if (builder->tokenizer) { + if ((builder->ii->header->flags & GRN_OBJ_WITH_SECTION) && + builder->tokenizer) { sid = i + 1; } rc = grn_ii_builder_append_value(ctx, builder, rid, sid, sec->weight, Added: test/command/suite/load/index/offline/vector_text_without_section.expected (+46 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/load/index/offline/vector_text_without_section.expected 2018-02-18 16:52:11 +0900 (df5fa7961) @@ -0,0 +1,46 @@ +plugin_register functions/index_column +[[0,0.0,0.0],true] +table_create Docs TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Docs sentences COLUMN_VECTOR Text +[[0,0.0,0.0],true] +load --table Docs +[ +{"sentences": ["-", "-", "-"]} +] +[[0,0.0,0.0],1] +table_create Words TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram +[[0,0.0,0.0],true] +column_create Words docs_sentences COLUMN_INDEX|WITH_POSITION Docs sentences +[[0,0.0,0.0],true] +select Words --limit -1 --sort_keys _key --output_columns '_key, index_column_source_records("docs_sentences")' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 1 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "index_column_source_records", + null + ] + ], + [ + "-", + [ + 1 + ] + ] + ] + ] +] Added: test/command/suite/load/index/offline/vector_text_without_section.test (+17 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/load/index/offline/vector_text_without_section.test 2018-02-18 16:52:11 +0900 (72c341b56) @@ -0,0 +1,17 @@ +plugin_register functions/index_column + +table_create Docs TABLE_NO_KEY +column_create Docs sentences COLUMN_VECTOR Text + +load --table Docs +[ +{"sentences": ["-", "-", "-"]} +] + +table_create Words TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram +column_create Words docs_sentences COLUMN_INDEX|WITH_POSITION Docs sentences + +select Words \ + --limit -1 \ + --sort_keys _key \ + --output_columns '_key, index_column_source_records("docs_sentences")' Added: test/command/suite/load/index/online/vector/text_without_section.expected (+46 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/load/index/online/vector/text_without_section.expected 2018-02-18 16:52:11 +0900 (125106f96) @@ -0,0 +1,46 @@ +plugin_register functions/index_column +[[0,0.0,0.0],true] +table_create Docs TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Docs sentences COLUMN_VECTOR Text +[[0,0.0,0.0],true] +table_create Words TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram +[[0,0.0,0.0],true] +column_create Words docs_sentences COLUMN_INDEX|WITH_POSITION Docs sentences +[[0,0.0,0.0],true] +load --table Docs +[ +{"sentences": ["-", "-", "-"]} +] +[[0,0.0,0.0],1] +select Words --limit -1 --sort_keys _key --output_columns '_key, index_column_source_records("docs_sentences")' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 1 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "index_column_source_records", + null + ] + ], + [ + "-", + [ + 1 + ] + ] + ] + ] +] Added: test/command/suite/load/index/online/vector/text_without_section.test (+17 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/load/index/online/vector/text_without_section.test 2018-02-18 16:52:11 +0900 (8a3bfe770) @@ -0,0 +1,17 @@ +plugin_register functions/index_column + +table_create Docs TABLE_NO_KEY +column_create Docs sentences COLUMN_VECTOR Text + +table_create Words TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram +column_create Words docs_sentences COLUMN_INDEX|WITH_POSITION Docs sentences + +load --table Docs +[ +{"sentences": ["-", "-", "-"]} +] + +select Words \ + --limit -1 \ + --sort_keys _key \ + --output_columns '_key, index_column_source_records("docs_sentences")' -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180218/2ec9529b/attachment-0001.htm