null+****@clear*****
null+****@clear*****
2010年 8月 24日 (火) 01:48:13 JST
Daijiro MORI 2010-08-23 16:48:13 +0000 (Mon, 23 Aug 2010)
New Revision: 3aac27ae01bfff1bd296f1e5190f06f2db8872b1
Log:
grn_token_next() override status to 'grn_token_not_found' only when it's not 'grn_token_done'.
Modified files:
lib/ii.c
lib/token.c
Modified: lib/ii.c (+5 -3)
===================================================================
--- lib/ii.c 2010-08-23 16:37:27 +0000 (286d18c)
+++ lib/ii.c 2010-08-23 16:48:13 +0000 (5bb1251)
@@ -5326,9 +5326,11 @@ token_info_build(grn_ctx *ctx, grn_obj *lexicon, grn_ii *ii, const char *string,
ti = token_info_open(ctx, lexicon, ii, key, size, token->pos, EX_NONE);
break;
case grn_token_done :
- key = _grn_table_key(ctx, lexicon, tid, &size);
- ti = token_info_open(ctx, lexicon, ii, key, size, token->pos, ef & EX_PREFIX);
- break;
+ if (tid) {
+ key = _grn_table_key(ctx, lexicon, tid, &size);
+ ti = token_info_open(ctx, lexicon, ii, key, size, token->pos, ef & EX_PREFIX);
+ break;
+ } /* else fallthru */
default :
ti = token_info_open(ctx, lexicon, ii, (char *)token->curr,
token->curr_size, token->pos, ef & EX_PREFIX);
Modified: lib/token.c (+3 -1)
===================================================================
--- lib/token.c 2010-08-23 16:37:27 +0000 (804976b)
+++ lib/token.c 2010-08-23 16:48:13 +0000 (1f9d4bb)
@@ -505,7 +505,9 @@ grn_token_next(grn_ctx *ctx, grn_token *token)
break;
}
}
- if (tid == GRN_ID_NIL) { token->status = grn_token_not_found; }
+ if (tid == GRN_ID_NIL && token->status != grn_token_done) {
+ token->status = grn_token_not_found;
+ }
token->pos++;
break;
}