Navigation Menu

Skip to content

Commit

Permalink
ii offline: fix a wrong index constructed bug
Browse files Browse the repository at this point in the history
It's caused only when vector column is a source and WITH_SECTION isn't
specified.
  • Loading branch information
kou committed Feb 18, 2018
1 parent b49f803 commit cf5e255
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ii.c
Expand Up @@ -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,
Expand Down
@@ -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
]
]
]
]
]
@@ -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")'
@@ -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
]
]
]
]
]
@@ -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")'

0 comments on commit cf5e255

Please sign in to comment.