[Groonga-commit] groonga/groonga at fc5437e [master] column_create: accept TokenDelmit with WITH_POSITION

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jun 26 17:13:52 JST 2018


Kouhei Sutou	2018-06-26 17:13:52 +0900 (Tue, 26 Jun 2018)

  New Revision: fc5437ed6c8372e1f5b234bfbf45ddd8b0291538
  https://github.com/groonga/groonga/commit/fc5437ed6c8372e1f5b234bfbf45ddd8b0291538

  Message:
    column_create: accept TokenDelmit with WITH_POSITION
    
    It's useful pattern for tag search.

  Added files:
    test/command/suite/column_create/index/source/vector_column/delimit_with_position.expected
    test/command/suite/column_create/index/source/vector_column/delimit_with_position.test
  Modified files:
    lib/db.c

  Modified: lib/db.c (+6 -4)
===================================================================
--- lib/db.c    2018-06-26 15:16:19 +0900 (b65947add)
+++ lib/db.c    2018-06-26 17:13:52 +0900 (4f2d0c231)
@@ -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);

  Added: test/command/suite/column_create/index/source/vector_column/delimit_with_position.expected (+10 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/column_create/index/source/vector_column/delimit_with_position.expected    2018-06-26 17:13:52 +0900 (feec424b9)
@@ -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]

  Added: test/command/suite/column_create/index/source/vector_column/delimit_with_position.test (+8 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/column_create/index/source/vector_column/delimit_with_position.test    2018-06-26 17:13:52 +0900 (95aa64a97)
@@ -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
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180626/bc4a59bb/attachment-0001.htm 



More information about the Groonga-commit mailing list
Back to archive index