[Groonga-commit] groonga/groonga at 19bd23c [master] table_tokenize: use "GET" as the default mode

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Oct 28 12:35:32 JST 2014


Kouhei Sutou	2014-10-28 12:35:32 +0900 (Tue, 28 Oct 2014)

  New Revision: 19bd23c70701c2932bd70dbb720d357a79e05252
  https://github.com/groonga/groonga/commit/19bd23c70701c2932bd70dbb720d357a79e05252

  Message:
    table_tokenize: use "GET" as the default mode
    
    Because changing existing table by default is dangerous.
    
    TODO:
    
      * Don't add tokens before tokenize with "GET" mode.

  Modified files:
    doc/source/reference/commands/table_tokenize.rst
    lib/proc.c

  Modified: doc/source/reference/commands/table_tokenize.rst (+5 -1)
===================================================================
--- doc/source/reference/commands/table_tokenize.rst    2014-10-28 12:32:07 +0900 (946df98)
+++ doc/source/reference/commands/table_tokenize.rst    2014-10-28 12:35:32 +0900 (81c118d)
@@ -23,7 +23,7 @@ optional::
   table_tokenize table
                  string
                  [flags=NONE]
-                 [mode=ADD]
+                 [mode=GET]
 
 Usage
 -----
@@ -82,6 +82,8 @@ There are optional parameters.
 It specifies a tokenization customize options. You can specify
 multiple options separated by "``|``".
 
+The default value is ``NONE``.
+
 See :ref:`tokenize-flags` option in :doc:`/reference/commands/tokenize` about details.
 
 ``mode``
@@ -89,6 +91,8 @@ See :ref:`tokenize-flags` option in :doc:`/reference/commands/tokenize` about de
 
 It specifies a tokenize mode.
 
+The default value is ``GET``.
+
 See :ref:`tokenize-mode` option in :doc:`/reference/commands/tokenize` about details.
 
 Return value

  Modified: lib/proc.c (+3 -3)
===================================================================
--- lib/proc.c    2014-10-28 12:32:07 +0900 (a192ed6)
+++ lib/proc.c    2014-10-28 12:35:32 +0900 (dd6de98)
@@ -3668,10 +3668,10 @@ proc_table_tokenize(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user
     (GRN_TEXT_LEN(mode_name) == strlen(name) &&\
      memcmp(GRN_TEXT_VALUE(mode_name), name, strlen(name)) == 0)
 
-    if (GRN_TEXT_LEN(mode_name) == 0 || MODE_NAME_EQUAL("ADD")) {
-      tokenize_add(ctx, lexicon, string, flags);
-    } else if (MODE_NAME_EQUAL("GET")) {
+    if (GRN_TEXT_LEN(mode_name) == 0 || MODE_NAME_EQUAL("GET")) {
       tokenize_get(ctx, lexicon, string, flags);
+    } else if (MODE_NAME_EQUAL("ADD")) {
+      tokenize_add(ctx, lexicon, string, flags);
     } else {
       ERR(GRN_INVALID_ARGUMENT, "[table_tokenize] invalid mode: <%.*s>",
           (int)GRN_TEXT_LEN(mode_name), GRN_TEXT_VALUE(mode_name));
-------------- next part --------------
HTML����������������������������...
下載 



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