[Groonga-commit] groonga/groonga at f70094c [master] Use "grn_obj_is_index_column()" for decision whether index column or not.

Back to archive index

Yasuhiro Horimoto null+****@clear*****
Wed Jun 20 13:40:05 JST 2018


Yasuhiro Horimoto	2018-06-20 13:40:05 +0900 (Wed, 20 Jun 2018)

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

  Merged 8a52f23: Merge pull request #850 from komainu8/add_check_exist_with_section_flag

  Message:
    Use "grn_obj_is_index_column()" for decision whether index column or not.

  Modified files:
    lib/db.c

  Modified: lib/db.c (+23 -22)
===================================================================
--- lib/db.c    2018-06-20 13:35:38 +0900 (4a99d27fc)
+++ lib/db.c    2018-06-20 13:40:05 +0900 (778fe2119)
@@ -8827,34 +8827,35 @@ grn_obj_set_info_source_validate(grn_ctx *ctx, grn_obj *obj, grn_obj *value)
 
   source_ids = (grn_id *)GRN_BULK_HEAD(value);
   n_source_ids = GRN_BULK_VSIZE(value) / sizeof(grn_id);
-  if (n_source_ids == 1) {
-    grn_obj *source;
+  if (grn_obj_is_index_column(ctx, obj)) {
+    if (n_source_ids == 1) {
+      grn_obj *source;
 
-    source = grn_ctx_at(ctx, source_ids[0]);
-    switch (source->header.type) {
-    case GRN_COLUMN_VAR_SIZE :
-      switch (source->header.flags & GRN_OBJ_COLUMN_TYPE_MASK) {
-      case GRN_OBJ_COLUMN_VECTOR :
-        if ((obj->header.flags & GRN_OBJ_COLUMN_INDEX)
-            && (obj->header.flags & GRN_OBJ_WITH_POSITION)
-            && (lexicon_have_tokenizer)) {
-          if (!(obj->header.flags & GRN_OBJ_WITH_SECTION)) {
-            char index_name[GRN_TABLE_MAX_KEY_SIZE];
-            int index_name_size;
-            index_name_size = grn_obj_name(ctx, obj,
-                                           index_name, GRN_TABLE_MAX_KEY_SIZE);
-            ERR(GRN_INVALID_ARGUMENT,
-                "grn_obj_set_info(): GRN_INFO_SOURCE: "
-                "full text index for vector column must be created with WITH_SECTION flag: <%.*s>",
-                index_name_size, index_name);
-            goto exit;
+      source = grn_ctx_at(ctx, source_ids[0]);
+      switch (source->header.type) {
+      case GRN_COLUMN_VAR_SIZE :
+        switch (source->header.flags & GRN_OBJ_COLUMN_TYPE_MASK) {
+        case GRN_OBJ_COLUMN_VECTOR :
+          if ((obj->header.flags & GRN_OBJ_WITH_POSITION)
+              && (lexicon_have_tokenizer)) {
+            if (!(obj->header.flags & GRN_OBJ_WITH_SECTION)) {
+              char index_name[GRN_TABLE_MAX_KEY_SIZE];
+              int index_name_size;
+              index_name_size = grn_obj_name(ctx, obj,
+                                             index_name, GRN_TABLE_MAX_KEY_SIZE);
+              ERR(GRN_INVALID_ARGUMENT,
+                  "grn_obj_set_info(): GRN_INFO_SOURCE: "
+                  "full text index for vector column must be created with WITH_SECTION flag: <%.*s>",
+                  index_name_size, index_name);
+              goto exit;
+            }
           }
+        default:
+          break;
         }
       default:
         break;
       }
-    default:
-      break;
     }
   }
 
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180620/2cc994e7/attachment-0001.htm 



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