Navigation Menu

Skip to content

Commit

Permalink
column_create: accept TokenDelmit with WITH_POSITION
Browse files Browse the repository at this point in the history
It's useful pattern for tag search.
  • Loading branch information
kou committed Jun 26, 2018
1 parent 5adf440 commit fc5437e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/db.c
Expand Up @@ -8824,11 +8824,13 @@ grn_obj_set_info_source_validate(grn_ctx *ctx, grn_obj *obj, grn_obj *value)
grn_obj *tokenizer;
grn_table_get_info(ctx, lexicon, NULL, NULL, &tokenizer, NULL, NULL);
lexicon_have_tokenizer = (tokenizer != NULL);

is_full_text_search_index =
(grn_obj_is_index_column(ctx, obj) &&
(obj->header.flags & GRN_OBJ_WITH_POSITION) &&
lexicon_have_tokenizer &&
grn_obj_id(ctx, tokenizer) != GRN_DB_DELIMIT);
}
is_full_text_search_index =
(grn_obj_is_index_column(ctx, obj) &&
(obj->header.flags & GRN_OBJ_WITH_POSITION) &&
lexicon_have_tokenizer);

source_ids = (grn_id *)GRN_BULK_HEAD(value);
n_source_ids = GRN_BULK_VSIZE(value) / sizeof(grn_id);
Expand Down
@@ -0,0 +1,10 @@
plugin_register functions/index_column
[[0,0.0,0.0],true]
table_create Tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit
[[0,0.0,0.0],true]
table_create Docs TABLE_NO_KEY
[[0,0.0,0.0],true]
column_create Docs tags COLUMN_VECTOR Tags
[[0,0.0,0.0],true]
column_create Tags docs_tags COLUMN_INDEX|WITH_POSITION Docs tags
[[0,0.0,0.0],true]
@@ -0,0 +1,8 @@
plugin_register functions/index_column

table_create Tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit

table_create Docs TABLE_NO_KEY
column_create Docs tags COLUMN_VECTOR Tags

column_create Tags docs_tags COLUMN_INDEX|WITH_POSITION Docs tags

0 comments on commit fc5437e

Please sign in to comment.