Permalink
Browse files

Don't assume that we can use fixed ID for normalizers

We can't use fixed ID for normalizers when we open a database that is
created by old groonga.
  • Loading branch information...
1 parent b3e53b8 commit 1e3ab2055991e1834f087b409294f0180a1a8d28 @kou kou committed Dec 29, 2012
Showing with 2 additions and 20 deletions.
  1. +0 −6 include/groonga.h
  2. +0 −4 lib/db.c
  3. +2 −10 lib/normalizer.c
View
@@ -610,12 +610,6 @@ typedef enum {
GRN_DB_TRIGRAM
} grn_builtin_tokenizer;
-typedef enum {
- GRN_DB_NORMALIZER_AUTO = 96,
- GRN_DB_NORMALIZER_NFKC51, /* Normalization Form KC for Unicode 5.1 */
- GRN_DB_NORMALIZER_UCA /* Unicode Collation Algorithm */
-} grn_builtin_normalizer;
-
GRN_API grn_obj *grn_ctx_at(grn_ctx *ctx, grn_id id);
/**
View
@@ -8504,10 +8504,6 @@ grn_db_init_builtin_types(grn_ctx *ctx)
}
#endif
grn_db_init_builtin_tokenizers(ctx);
- for (id = grn_db_curr_id(ctx, db) + 1; id < GRN_DB_NORMALIZER_AUTO; id++) {
- grn_itoh(id, buf + 3, 2);
- grn_obj_register(ctx, db, buf, 5);
- }
grn_db_init_builtin_normalizers(ctx);
for (id = grn_db_curr_id(ctx, db) + 1; id < 128; id++) {
grn_itoh(id, buf + 3, 2);
View
@@ -1174,18 +1174,10 @@ grn_normalizer_normalize(grn_ctx *ctx, grn_obj *normalizer, grn_obj *string)
grn_rc
grn_db_init_builtin_normalizers(grn_ctx *ctx)
{
- grn_rc rc;
const char *normalizer_nfkc51_name = "NormalizerNFKC51";
- rc = grn_normalizer_register(ctx, GRN_NORMALIZER_AUTO_NAME, -1,
- NULL, auto_next, NULL);
- if (rc == GRN_SUCCESS) {
- grn_obj *obj;
- obj = grn_ctx_get(ctx, normalizer_auto_name, -1);
- if (!obj || ((grn_db_obj *)obj)->id != GRN_DB_NORMALIZER_AUTO) {
- return GRN_FILE_CORRUPT;
- }
- }
+ grn_normalizer_register(ctx, GRN_NORMALIZER_AUTO_NAME, -1,
+ NULL, auto_next, NULL);
#ifdef WITH_NFKC
grn_normalizer_register(ctx, normalizer_nfkc51_name, -1,

0 comments on commit 1e3ab20

Please sign in to comment.