null+****@clear*****
null+****@clear*****
2012年 3月 15日 (木) 14:28:23 JST
Daijiro MORI 2012-03-15 14:28:23 +0900 (Thu, 15 Mar 2012) New Revision: 1364cbdcb08217ee095fd23f1a303bd3b64b2d10 Log: Enable grn_dat to execute TERM_EXTRACT operations. Modified files: lib/db.c Modified: lib/db.c (+16 -0) =================================================================== --- lib/db.c 2012-03-15 09:48:29 +0900 (87c095e) +++ lib/db.c 2012-03-15 14:28:23 +0900 (c66c3f3) @@ -2720,6 +2720,22 @@ grn_table_search(grn_ctx *ctx, grn_obj *table, const void *key, uint32_t key_siz if (id) { grn_table_add(ctx, res, &id, sizeof(grn_id), NULL); } } break; + case GRN_OP_TERM_EXTRACT : + { + int len; + grn_id tid; + const char *sp = key; + const char *se = sp + key_size; + for (; sp < se; sp += len) { + if ((tid = grn_dat_lcp_search(ctx, dat, sp, se - sp))) { + grn_table_add(ctx, res, &tid, sizeof(grn_id), NULL); + /* todo : nsubrec++ if GRN_OBJ_TABLE_SUBSET assigned */ + } + if (!(len = grn_charlen(ctx, sp, se))) { break; } + } + } + // todo : support op; + break; default : rc = GRN_INVALID_ARGUMENT; ERR(rc, "invalid mode %d", mode);