[Groonga-commit] groonga/groonga at dcccdeb [master] ii: disable ".*" index search support by default

Zurück zum Archiv-Index

Kouhei Sutou null+****@clear*****
Wed Apr 12 09:14:08 JST 2017


Kouhei Sutou	2017-04-12 09:14:08 +0900 (Wed, 12 Apr 2017)

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

  Message:
    ii: disable ".*" index search support by default

  Modified files:
    lib/ii.c
    test/command/suite/select/filter/index/regexp/dot_asterisk.test

  Modified: lib/ii.c (+15 -1)
===================================================================
--- lib/ii.c    2017-04-11 13:30:54 +0900 (1f9ca03)
+++ lib/ii.c    2017-04-12 09:14:08 +0900 (b7ebda9)
@@ -101,6 +101,7 @@ static grn_bool grn_ii_overlap_token_skip_enable = GRN_FALSE;
 static uint32_t grn_ii_builder_block_threshold_force = 0;
 static uint32_t grn_ii_max_n_segments_small = MAX_PSEG_SMALL;
 static uint32_t grn_ii_max_n_chunks_small = GRN_II_MAX_CHUNK_SMALL;
+static grn_bool grn_ii_regexp_dot_asterisk_enable = GRN_FALSE;
 
 void
 grn_ii_init_from_env(void)
@@ -200,6 +201,18 @@ grn_ii_init_from_env(void)
       }
     }
   }
+
+  {
+    char grn_ii_regexp_dot_asterisk_enable_env[GRN_ENV_BUFFER_SIZE];
+    grn_getenv("GRN_II_REGEXP_DOT_ASTERISK_ENABLE",
+               grn_ii_regexp_dot_asterisk_enable_env,
+               GRN_ENV_BUFFER_SIZE);
+    if (strcmp(grn_ii_regexp_dot_asterisk_enable_env, "yes") == 0) {
+      grn_ii_regexp_dot_asterisk_enable = GRN_TRUE;
+    } else {
+      grn_ii_regexp_dot_asterisk_enable = GRN_FALSE;
+    }
+  }
 }
 
 void
@@ -8029,7 +8042,8 @@ grn_ii_parse_regexp_query(grn_ctx *ctx,
         if (*target == '\\') {
           escaping = GRN_TRUE;
           continue;
-        } else if (*target == '.' &&
+        } else if (grn_ii_regexp_dot_asterisk_enable &&
+                   *target == '.' &&
                    grn_charlen(ctx, current, string_end) == 1 &&
                    *current == '*') {
           if (GRN_TEXT_LEN(&buffer) > 0) {

  Modified: test/command/suite/select/filter/index/regexp/dot_asterisk.test (+2 -0)
===================================================================
--- test/command/suite/select/filter/index/regexp/dot_asterisk.test    2017-04-11 13:30:54 +0900 (a85e2c0)
+++ test/command/suite/select/filter/index/regexp/dot_asterisk.test    2017-04-12 09:14:08 +0900 (e799827)
@@ -1,3 +1,5 @@
+#$GRN_II_REGEXP_DOT_ASTERISK_ENABLE=yes
+
 table_create Memos TABLE_NO_KEY
 column_create Memos content COLUMN_SCALAR Text
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index