[Groonga-commit] groonga/groonga at 004bdeb [master] token_cursor: add GRN_TOKENIZE_ONLY mode

Back to archive index

naoa null+****@clear*****
Wed Feb 3 06:30:45 JST 2016


naoa	2016-02-03 06:30:45 +0900 (Wed, 03 Feb 2016)

  New Revision: 004bdebd901c89df27be461719d5bca891f5a9e0
  https://github.com/groonga/groonga/commit/004bdebd901c89df27be461719d5bca891f5a9e0

  Merged e4e194e: Merge pull request #463 from naoa/op-fuzzy

  Message:
    token_cursor: add GRN_TOKENIZE_ONLY mode
    
    It can tokenize even if table has no key

  Modified files:
    include/groonga/token.h
    lib/token_cursor.c

  Modified: include/groonga/token.h (+2 -1)
===================================================================
--- include/groonga/token.h    2016-02-02 14:22:04 +0900 (20f9fe2)
+++ include/groonga/token.h    2016-02-03 06:30:45 +0900 (af5e656)
@@ -36,7 +36,8 @@ extern "C" {
 typedef enum {
   GRN_TOKENIZE_GET = 0,
   GRN_TOKENIZE_ADD,
-  GRN_TOKENIZE_DELETE
+  GRN_TOKENIZE_DELETE,
+  GRN_TOKENIZE_ONLY
 } grn_tokenize_mode;
 
 /*

  Modified: lib/token_cursor.c (+3 -2)
===================================================================
--- lib/token_cursor.c    2016-02-02 14:22:04 +0900 (ac1c936)
+++ lib/token_cursor.c    2016-02-03 06:30:45 +0900 (c974eba)
@@ -290,7 +290,7 @@ grn_token_cursor_next(grn_ctx *ctx, grn_token_cursor *token_cursor)
         }
         break;
       }
-    } else {
+    } else if (token_cursor->mode != GRN_TOKENIZE_ONLY) {
       switch (table->header.type) {
       case GRN_TABLE_PAT_KEY :
         tid = grn_pat_get(ctx, (grn_pat *)table, token_cursor->curr, token_cursor->curr_size, NULL);
@@ -310,7 +310,8 @@ grn_token_cursor_next(grn_ctx *ctx, grn_token_cursor *token_cursor)
         break;
       }
     }
-    if (tid == GRN_ID_NIL && token_cursor->status != GRN_TOKEN_CURSOR_DONE) {
+    if (token_cursor->mode != GRN_TOKENIZE_ONLY &&
+        tid == GRN_ID_NIL && token_cursor->status != GRN_TOKEN_CURSOR_DONE) {
       token_cursor->status = GRN_TOKEN_CURSOR_NOT_FOUND;
     }
     token_cursor->pos++;
-------------- next part --------------
HTML����������������������������...
Download 



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