[Groonga-commit] groonga/groonga [master] truncate: support normalizer

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Dec 20 18:46:55 JST 2012


Kouhei Sutou	2012-12-20 18:46:55 +0900 (Thu, 20 Dec 2012)

  New Revision: 557d0279e8d5fa1a23adb933f2dc8b4937abef7c
  https://github.com/groonga/groonga/commit/557d0279e8d5fa1a23adb933f2dc8b4937abef7c

  Log:
    truncate: support normalizer

  Added files:
    test/command/suite/truncate/key_normalize_dat.expected
    test/command/suite/truncate/key_normalize_dat.test
    test/command/suite/truncate/key_normalize_hash.expected
    test/command/suite/truncate/key_normalize_hash.test
    test/command/suite/truncate/key_normalize_pat.expected
    test/command/suite/truncate/key_normalize_pat.test
    test/command/suite/truncate/normalizer_dat.expected
    test/command/suite/truncate/normalizer_dat.test
    test/command/suite/truncate/normalizer_hash.expected
    test/command/suite/truncate/normalizer_hash.test
    test/command/suite/truncate/normalizer_pat.expected
    test/command/suite/truncate/normalizer_pat.test
  Modified files:
    lib/db.c

  Modified: lib/db.c (+3 -1)
===================================================================
--- lib/db.c    2012-12-20 18:39:11 +0900 (de38c92)
+++ lib/db.c    2012-12-20 18:46:55 +0900 (ddef5d4)
@@ -1802,6 +1802,7 @@ grn_table_truncate(grn_ctx *ctx, grn_obj *table)
     grn_hook *hooks;
     grn_hash *cols;
     grn_obj *tokenizer;
+    grn_obj *normalizer;
     if ((cols = grn_hash_create(ctx, NULL, sizeof(grn_id), 0,
                                 GRN_OBJ_TABLE_HASH_KEY|GRN_HASH_TINY))) {
       if (grn_table_columns(ctx, table, "", 0, (grn_obj *)cols)) {
@@ -1813,7 +1814,7 @@ grn_table_truncate(grn_ctx *ctx, grn_obj *table)
       }
       grn_hash_close(ctx, cols);
     }
-    grn_table_get_info(ctx, table, NULL, NULL, &tokenizer, NULL);
+    grn_table_get_info(ctx, table, NULL, NULL, &tokenizer, &normalizer);
     switch (table->header.type) {
     case GRN_TABLE_PAT_KEY :
       for (hooks = DB_OBJ(table)->hooks[GRN_HOOK_INSERT]; hooks; hooks = hooks->next) {
@@ -1847,6 +1848,7 @@ grn_table_truncate(grn_ctx *ctx, grn_obj *table)
       break;
     }
     grn_obj_set_info(ctx, table, GRN_INFO_DEFAULT_TOKENIZER, tokenizer);
+    grn_obj_set_info(ctx, table, GRN_INFO_NORMALIZER, normalizer);
     grn_obj_touch(ctx, table, NULL);
   }
 exit :

  Added: test/command/suite/truncate/key_normalize_dat.expected (+10 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/key_normalize_dat.expected    2012-12-20 18:46:55 +0900 (4b1c722)
@@ -0,0 +1,10 @@
+table_create Tags TABLE_DAT_KEY|KEY_NORMALIZE ShortText
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_DAT_KEY ShortText --normalizer NormalizerAuto
+
+truncate Tags
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_DAT_KEY ShortText --normalizer NormalizerAuto
+

  Added: test/command/suite/truncate/key_normalize_dat.test (+5 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/key_normalize_dat.test    2012-12-20 18:46:55 +0900 (f5801eb)
@@ -0,0 +1,5 @@
+table_create Tags TABLE_DAT_KEY|KEY_NORMALIZE ShortText
+dump
+
+truncate Tags
+dump

  Added: test/command/suite/truncate/key_normalize_hash.expected (+10 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/key_normalize_hash.expected    2012-12-20 18:46:55 +0900 (13d44bd)
@@ -0,0 +1,10 @@
+table_create Tags TABLE_HASH_KEY|KEY_NORMALIZE ShortText
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_HASH_KEY ShortText --normalizer NormalizerAuto
+
+truncate Tags
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_HASH_KEY ShortText --normalizer NormalizerAuto
+

  Added: test/command/suite/truncate/key_normalize_hash.test (+5 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/key_normalize_hash.test    2012-12-20 18:46:55 +0900 (152b317)
@@ -0,0 +1,5 @@
+table_create Tags TABLE_HASH_KEY|KEY_NORMALIZE ShortText
+dump
+
+truncate Tags
+dump

  Added: test/command/suite/truncate/key_normalize_pat.expected (+10 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/key_normalize_pat.expected    2012-12-20 18:46:55 +0900 (f72f612)
@@ -0,0 +1,10 @@
+table_create Tags TABLE_PAT_KEY|KEY_NORMALIZE ShortText
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_PAT_KEY ShortText --normalizer NormalizerAuto
+
+truncate Tags
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_PAT_KEY ShortText --normalizer NormalizerAuto
+

  Added: test/command/suite/truncate/key_normalize_pat.test (+5 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/key_normalize_pat.test    2012-12-20 18:46:55 +0900 (7a63a28)
@@ -0,0 +1,5 @@
+table_create Tags TABLE_PAT_KEY|KEY_NORMALIZE ShortText
+dump
+
+truncate Tags
+dump

  Added: test/command/suite/truncate/normalizer_dat.expected (+10 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/normalizer_dat.expected    2012-12-20 18:46:55 +0900 (5498385)
@@ -0,0 +1,10 @@
+table_create Tags TABLE_DAT_KEY ShortText --normalizer NormalizerNFKC51
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_DAT_KEY ShortText --normalizer NormalizerNFKC51
+
+truncate Tags
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_DAT_KEY ShortText --normalizer NormalizerNFKC51
+

  Added: test/command/suite/truncate/normalizer_dat.test (+5 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/normalizer_dat.test    2012-12-20 18:46:55 +0900 (a52784a)
@@ -0,0 +1,5 @@
+table_create Tags TABLE_DAT_KEY ShortText --normalizer NormalizerNFKC51
+dump
+
+truncate Tags
+dump

  Added: test/command/suite/truncate/normalizer_hash.expected (+10 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/normalizer_hash.expected    2012-12-20 18:46:55 +0900 (ed6c788)
@@ -0,0 +1,10 @@
+table_create Tags TABLE_HASH_KEY ShortText --normalizer NormalizerNFKC51
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_HASH_KEY ShortText --normalizer NormalizerNFKC51
+
+truncate Tags
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_HASH_KEY ShortText --normalizer NormalizerNFKC51
+

  Added: test/command/suite/truncate/normalizer_hash.test (+5 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/normalizer_hash.test    2012-12-20 18:46:55 +0900 (086f845)
@@ -0,0 +1,5 @@
+table_create Tags TABLE_HASH_KEY ShortText --normalizer NormalizerNFKC51
+dump
+
+truncate Tags
+dump

  Added: test/command/suite/truncate/normalizer_pat.expected (+10 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/normalizer_pat.expected    2012-12-20 18:46:55 +0900 (407e80b)
@@ -0,0 +1,10 @@
+table_create Tags TABLE_PAT_KEY ShortText --normalizer NormalizerNFKC51
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_PAT_KEY ShortText --normalizer NormalizerNFKC51
+
+truncate Tags
+[[0,0.0,0.0],true]
+dump
+table_create Tags TABLE_PAT_KEY ShortText --normalizer NormalizerNFKC51
+

  Added: test/command/suite/truncate/normalizer_pat.test (+5 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/truncate/normalizer_pat.test    2012-12-20 18:46:55 +0900 (cb0d3b5)
@@ -0,0 +1,5 @@
+table_create Tags TABLE_PAT_KEY ShortText --normalizer NormalizerNFKC51
+dump
+
+truncate Tags
+dump
-------------- next part --------------
HTML����������������������������...
Download 



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