[Groonga-commit] groonga/groonga [master] Fixed a bug cause grn_pat_cursor_open() returns wrong result.

Back to archive index

null+****@clear***** null+****@clear*****
2010年 8月 2日 (月) 19:43:05 JST


Daijiro MORI	2010-08-02 10:43:05 +0000 (Mon, 02 Aug 2010)

  New Revision: d5a60120831ae0467cb3f2cce5a3ccbf12937ee2

  Log:
    Fixed a bug cause grn_pat_cursor_open() returns wrong result.

  Modified files:
    lib/pat.c

  Modified: lib/pat.c (+12 -8)
===================================================================
--- lib/pat.c    2010-08-02 08:33:14 +0000 (1324bd9)
+++ lib/pat.c    2010-08-02 10:43:05 +0000 (96b627e)
@@ -1713,16 +1713,20 @@ set_cursor_prefix(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c,
     if ((flags & GRN_CURSOR_SIZE_BY_BIT)
         ? !bitcmp(k, key, 0, key_size)
         : !memcmp(k, key, key_size)) {
-      if (flags & GRN_CURSOR_DESCENDING) {
-        if ((ch > len - 1) || !(flags & GRN_CURSOR_GT)) {
-          push(c, node->lr[0], ch);
+      if (c0 < ch) {
+        if (flags & GRN_CURSOR_DESCENDING) {
+          if ((ch > len - 1) || !(flags & GRN_CURSOR_GT)) {
+            push(c, node->lr[0], ch);
+          }
+          push(c, node->lr[1], ch);
+        } else {
+          push(c, node->lr[1], ch);
+          if ((ch > len - 1) || !(flags & GRN_CURSOR_GT)) {
+            push(c, node->lr[0], ch);
+          }
         }
-        push(c, node->lr[1], ch);
       } else {
-        push(c, node->lr[1], ch);
-        if ((ch > len - 1) || !(flags & GRN_CURSOR_GT)) {
-          push(c, node->lr[0], ch);
-        }
+        push(c, id, ch);
       }
     }
     break;




Groonga-commit メーリングリストの案内
Back to archive index