null+****@clear*****
null+****@clear*****
2012年 2月 14日 (火) 14:14:33 JST
Kouhei Sutou 2012-02-14 14:14:33 +0900 (Tue, 14 Feb 2012)
New Revision: 8e8d92eaad95a3a1809b6c7136f1536f694f1ea0
Log:
reverted normalizer plugin related changes.
Modified files:
lib/ii.c
lib/tokenizer.c
lib/util.c
Modified: lib/ii.c (+3 -5)
===================================================================
--- lib/ii.c 2012-02-14 14:00:52 +0900 (66dbbe3)
+++ lib/ii.c 2012-02-14 14:14:33 +0900 (78df2ad)
@@ -6548,7 +6548,7 @@ grn_ii_buffer_tokenize(grn_ctx *ctx, grn_ii_buffer *ii_buffer,
grn_obj *range = grn_ctx_at(ctx, DB_OBJ(ii_buffer->lexicon)->range);
grn_obj *tokenizer;
grn_obj_flags flags;
- grn_table_get_info(ctx, builder->lexicon, &flags, NULL, &tokenizer);
+ grn_table_get_info(ctx, ii_buffer->lexicon, &flags, NULL, &tokenizer);
flags &= ~GRN_OBJ_PERSISTENT;
ii_buffer->tmp_lexicon = grn_table_create(ctx, NULL, 0, NULL, flags, domain, range);
grn_obj_set_info(ctx, ii_buffer->tmp_lexicon, GRN_INFO_DEFAULT_TOKENIZER, tokenizer);
@@ -6804,11 +6804,9 @@ grn_ii_buffer_open(grn_ctx *ctx, grn_ii *ii)
O_WRONLY|O_CREAT|O_TRUNC|O_NONBLOCK, 0666);
if (ii_buffer->tmpfd) {
grn_obj_flags flags;
- grn_table_get_info(ctx, ii->lexicon,
- &flags, NULL, NULL, NULL);
+ grn_table_get_info(ctx, ii->lexicon, &flags, NULL, NULL);
if (flags & GRN_OBJ_TABLE_PAT_KEY) {
- grn_pat_cache_enable(ctx, (grn_pat *)ii->lexicon,
- PAT_CACHE_SIZE);
+ grn_pat_cache_enable(ctx, (grn_pat *)ii->lexicon, PAT_CACHE_SIZE);
}
return ii_buffer;
} else {
Modified: lib/tokenizer.c (+9 -1)
===================================================================
--- lib/tokenizer.c 2012-02-14 14:00:52 +0900 (e65cea5)
+++ lib/tokenizer.c 2012-02-14 14:14:33 +0900 (00365aa)
@@ -105,6 +105,14 @@ grn_tokenizer_query *grn_tokenizer_query_create(grn_ctx *ctx,
grn_obj * const table = args[0];
grn_obj_flags table_flags;
grn_encoding table_encoding;
+ unsigned int query_length = GRN_TEXT_LEN(query_str);
+ char *query_buf = (char *)GRN_PLUGIN_MALLOC(ctx, query_length + 1);
+ if (query_buf == NULL) {
+ GRN_PLUGIN_FREE(ctx, query);
+ GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
+ "[tokenizer] failed to duplicate query");
+ return NULL;
+ }
grn_table_get_info(ctx, table, &table_flags, &table_encoding, NULL);
{
grn_str * const str = grn_str_open_(ctx, GRN_TEXT_VALUE(query_str),
@@ -112,7 +120,7 @@ grn_tokenizer_query *grn_tokenizer_query_create(grn_ctx *ctx,
table_flags & GRN_OBJ_KEY_NORMALIZE,
table_encoding);
if (str == NULL) {
- GRN_TOKENIZER_FREE(ctx, query);
+ GRN_PLUGIN_FREE(ctx, query);
return NULL;
}
memcpy(query_buf, GRN_TEXT_VALUE(query_str), query_length);
Modified: lib/util.c (+0 -3)
===================================================================
--- lib/util.c 2012-02-14 14:00:52 +0900 (fad7124)
+++ lib/util.c 2012-02-14 14:14:33 +0900 (8261b61)
@@ -120,9 +120,6 @@ grn_inspect_type(grn_ctx *ctx, grn_obj *buf, unsigned char type)
case GRN_PATSNIP :
GRN_TEXT_PUTS(ctx, buf, "GRN_PATSNIP");
break;
- case GRN_NORMALIZED_TEXT :
- GRN_TEXT_PUTS(ctx, buf, "GRN_NORMALIZED_TEXT");
- break;
case GRN_CURSOR_TABLE_HASH_KEY :
GRN_TEXT_PUTS(ctx, buf, "GRN_CURSOR_TABLE_HASH_KEY");
break;