[Groonga-commit] groonga/groonga [master] table_create: don't set normalizer if --normalizer isn't specified

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Dec 20 18:39:11 JST 2012


Kouhei Sutou	2012-12-20 18:39:11 +0900 (Thu, 20 Dec 2012)

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

  Log:
    table_create: don't set normalizer if --normalizer isn't specified

  Modified files:
    lib/proc.c

  Modified: lib/proc.c (+9 -5)
===================================================================
--- lib/proc.c    2012-12-20 18:37:58 +0900 (13fe1ce)
+++ lib/proc.c    2012-12-20 18:39:11 +0900 (1503434)
@@ -1100,15 +1100,19 @@ proc_table_create(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_d
                              key_type,
                              value_type);
     if (table) {
+      grn_obj *normalizer_name;
       grn_obj_set_info(ctx, table,
                        GRN_INFO_DEFAULT_TOKENIZER,
                        grn_ctx_get(ctx, GRN_TEXT_VALUE(VAR(4)),
                                    GRN_TEXT_LEN(VAR(4))));
-      grn_obj_set_info(ctx, table,
-                       GRN_INFO_NORMALIZER,
-                       grn_ctx_get(ctx,
-                                   GRN_TEXT_VALUE(VAR(5)),
-                                   GRN_TEXT_LEN(VAR(5))));
+      normalizer_name = VAR(5);
+      if (GRN_TEXT_LEN(normalizer_name) > 0) {
+        grn_obj_set_info(ctx, table,
+                         GRN_INFO_NORMALIZER,
+                         grn_ctx_get(ctx,
+                                     GRN_TEXT_VALUE(normalizer_name),
+                                     GRN_TEXT_LEN(normalizer_name)));
+      }
       grn_obj_unlink(ctx, table);
     }
   } else {
-------------- next part --------------
HTML����������������������������...
Download 



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