[Groonga-commit] groonga/groonga at ec2ea96 [master] ii: always use 1byte step for text data to find a new buffer

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Jan 13 23:06:15 JST 2018


Kouhei Sutou	2018-01-13 23:06:15 +0900 (Sat, 13 Jan 2018)

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

  Message:
    ii: always use 1byte step for text data to find a new buffer
    
    Binary data uses ** 2 step again.

  Modified files:
    lib/ii.c

  Modified: lib/ii.c (+7 -2)
===================================================================
--- lib/ii.c    2018-01-12 16:26:11 +0900 (6335be558)
+++ lib/ii.c    2018-01-13 23:06:15 +0900 (8dba7932b)
@@ -4088,10 +4088,13 @@ buffer_new_lexicon_pat(grn_ctx *ctx,
         grn_pat_cursor_close(ctx, cursor);
       }
     } else {
-      /* For text data */
+      /* For binary data or text data */
+      grn_bool is_binary_data;
       int target_key_size = key_size;
       int reduced_key_size = 0;
 
+      is_binary_data = (ctx->encoding == GRN_ENC_NONE);
+
       while (*lseg == GRN_II_PSEG_NOT_ASSIGNED && target_key_size > 0) {
         grn_id tid;
 
@@ -4131,7 +4134,9 @@ buffer_new_lexicon_pat(grn_ctx *ctx,
         if (reduced_key_size == 0) {
           reduced_key_size = 1;
         } else {
-          reduced_key_size += (key_size - target_key_size) / 16;
+          if (is_binary_data) {
+            reduced_key_size *= 2;
+          }
         }
         target_key_size -= reduced_key_size;
       }
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180113/17b1d29d/attachment.htm 



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