[Groonga-commit] groonga/groonga at bcf470a [master] pat: use meaningful argument name of grn_pat_fuzzy_search()

Back to archive index

naoa null+****@clear*****
Mon Feb 1 16:20:19 JST 2016


naoa	2016-02-01 16:20:19 +0900 (Mon, 01 Feb 2016)

  New Revision: bcf470ae39f6796bc454706320d90f61ed3fa33f
  https://github.com/groonga/groonga/commit/bcf470ae39f6796bc454706320d90f61ed3fa33f

  Merged 2d929d3: Merge pull request #460 from naoa/pat-fussy-search

  Message:
    pat: use meaningful argument name of grn_pat_fuzzy_search()
    
    max_size -> prefix_match_size

  Modified files:
    lib/grn_pat.h
    lib/pat.c

  Modified: lib/grn_pat.h (+2 -1)
===================================================================
--- lib/grn_pat.h    2016-02-01 02:51:25 +0900 (298fa30)
+++ lib/grn_pat.h    2016-02-01 16:20:19 +0900 (2785b27)
@@ -110,7 +110,8 @@ void grn_pat_cache_disable(grn_ctx *ctx, grn_pat *pat);
 #define WITH_TRANSPOSITION                  (0x01)
 
 GRN_API grn_rc grn_pat_fuzzy_search(grn_ctx *ctx, grn_pat *pat,
-                                    const void *key, unsigned int key_size, unsigned int max_size,
+                                    const void *key, unsigned int key_size,
+                                    unsigned int prefix_match_size,
                                     unsigned int max_distance, int flags, grn_hash *h);
 
 #ifdef __cplusplus

  Modified: lib/pat.c (+5 -4)
===================================================================
--- lib/pat.c    2016-02-01 02:51:25 +0900 (89ac1b1)
+++ lib/pat.c    2016-02-01 16:20:19 +0900 (706d49e)
@@ -1385,7 +1385,8 @@ _grn_pat_fuzzy_search(grn_ctx *ctx, grn_pat *pat, grn_id id,
 
 grn_rc
 grn_pat_fuzzy_search(grn_ctx *ctx, grn_pat *pat,
-                     const void *key, uint32_t key_size, uint32_t max_size,
+                     const void *key, uint32_t key_size,
+                     uint32_t prefix_match_size,
                      uint32_t max_distance, int flags, grn_hash *h)
 {
   pat_node *node;
@@ -1400,15 +1401,15 @@ grn_pat_fuzzy_search(grn_ctx *ctx, grn_pat *pat,
 
   if (key_size > GRN_TABLE_MAX_KEY_SIZE ||
       max_distance > GRN_TABLE_MAX_KEY_SIZE ||
-      max_size > key_size) {
+      prefix_match_size > key_size) {
     return GRN_INVALID_ARGUMENT;
   }
   if (grn_pat_error_if_truncated(ctx, pat) != GRN_SUCCESS) {
     return GRN_ID_NIL;
   }
-  if (max_size) {
+  if (prefix_match_size) {
     grn_pat_cursor *cur;
-    if ((cur = grn_pat_cursor_open(ctx, pat, key, max_size,
+    if ((cur = grn_pat_cursor_open(ctx, pat, key, prefix_match_size,
                                    NULL, 0, 0, -1, GRN_CURSOR_PREFIX))) {
       grn_id tid;
       tid = grn_pat_cursor_next(ctx, cur);
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index