[Groonga-commit] groonga/groonga at 197d92f [master] Use "grn_obj_is_vector_column()" for decision whether vector column or not.

Back to archive index

Yasuhiro Horimoto null+****@clear*****
Thu Jun 21 13:52:09 JST 2018


Yasuhiro Horimoto	2018-06-21 13:52:09 +0900 (Thu, 21 Jun 2018)

  New Revision: 197d92f611815f119a0425bdce9033705181ee5f
  https://github.com/groonga/groonga/commit/197d92f611815f119a0425bdce9033705181ee5f

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

  Message:
    Use "grn_obj_is_vector_column()" for decision whether vector column or not.

  Modified files:
    lib/db.c

  Modified: lib/db.c (+13 -21)
===================================================================
--- lib/db.c    2018-06-20 21:35:25 +0900 (778fe2119)
+++ lib/db.c    2018-06-21 13:52:09 +0900 (ecc1fcd46)
@@ -8832,29 +8832,21 @@ grn_obj_set_info_source_validate(grn_ctx *ctx, grn_obj *obj, grn_obj *value)
       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_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;
-            }
+      if (grn_obj_is_vector_column(ctx, source)) {
+        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;
       }
     }
   }
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180621/da01ae6e/attachment-0001.htm 



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