naoa
null+****@clear*****
Tue Feb 2 14:15:56 JST 2016
naoa 2016-02-02 14:15:56 +0900 (Tue, 02 Feb 2016) New Revision: dbfdbf37b29257b4f72275a5403b1caace154534 https://github.com/groonga/groonga/commit/dbfdbf37b29257b4f72275a5403b1caace154534 Merged e4e194e: Merge pull request #463 from naoa/op-fuzzy Message: db: Add grn_table_fuzzy_search() Modified files: lib/db.c lib/grn_db.h Modified: lib/db.c (+27 -0) =================================================================== --- lib/db.c 2016-02-01 23:38:58 +0900 (99f70f4) +++ lib/db.c 2016-02-02 14:15:56 +0900 (d0dae2f) @@ -2913,6 +2913,33 @@ grn_table_search(grn_ctx *ctx, grn_obj *table, const void *key, uint32_t key_siz GRN_API_RETURN(rc); } +grn_rc +grn_table_fuzzy_search(grn_ctx *ctx, grn_obj *table, const void *key, uint32_t key_size, + uint32_t prefix_match_size, uint32_t max_distance, int flags, + grn_obj *res) +{ + grn_rc rc = GRN_SUCCESS; + GRN_API_ENTER; + switch (table->header.type) { + case GRN_TABLE_PAT_KEY : + { + grn_pat *pat = (grn_pat *)table; + WITH_NORMALIZE(pat, key, key_size, { + rc = grn_pat_fuzzy_search(ctx, pat, key, key_size, + prefix_match_size, + max_distance, + flags, + (grn_hash *)res); + }); + } + break; + default : + rc = GRN_OPERATION_NOT_SUPPORTED; + break; + } + GRN_API_RETURN(rc); +} + grn_id grn_table_next(grn_ctx *ctx, grn_obj *table, grn_id id) { Modified: lib/grn_db.h (+5 -0) =================================================================== --- lib/grn_db.h 2016-02-01 23:38:58 +0900 (c813db8) +++ lib/grn_db.h 2016-02-02 14:15:56 +0900 (a0a5662) @@ -83,6 +83,11 @@ grn_rc grn_table_search(grn_ctx *ctx, grn_obj *table, const void *key, uint32_t key_size, grn_operator mode, grn_obj *res, grn_operator op); +grn_rc grn_table_fuzzy_search(grn_ctx *ctx, grn_obj *table, + const void *key, uint32_t key_size, + uint32_t prefix_match_size, + uint32_t max_distance, int flags, grn_obj *res); + grn_id grn_table_next(grn_ctx *ctx, grn_obj *table, grn_id id); int grn_table_get_key2(grn_ctx *ctx, grn_obj *table, grn_id id, grn_obj *bulk); -------------- next part -------------- HTML����������������������������...Download