[Groonga-commit] groonga/groonga at e236a87 [master] Fix a bug that nested index resolving may return nonexistent record

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Thu May 26 09:38:55 JST 2016


Kouhei Sutou	2016-05-26 09:38:55 +0900 (Thu, 26 May 2016)

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

  Message:
    Fix a bug that nested index resolving may return nonexistent record

  Added files:
    test/command/suite/select/slices/index/filtered.expected
    test/command/suite/select/slices/index/filtered.test
  Modified files:
    lib/db.c

  Modified: lib/db.c (+3 -0)
===================================================================
--- lib/db.c    2016-05-26 09:38:07 +0900 (67b5ea2)
+++ lib/db.c    2016-05-26 09:38:55 +0900 (cac6d0d)
@@ -3221,6 +3221,9 @@ grn_accessor_resolve_one_table(grn_ctx *ctx, grn_accessor *accessor,
                                      table,
                                      record_id,
                                      sizeof(grn_id));
+      if (next_record_id == GRN_ID_NIL) {
+        continue;
+      }
 
       posting.rid = next_record_id;
       posting.weight = recinfo->score;

  Added: test/command/suite/select/slices/index/filtered.expected (+84 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/slices/index/filtered.expected    2016-05-26 09:38:55 +0900 (6c41a4c)
@@ -0,0 +1,84 @@
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+table_create Memos TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Memos date COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Memos tag COLUMN_SCALAR Tags
+[[0,0.0,0.0],true]
+column_create Tags memos_tag COLUMN_INDEX Memos tag
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key": "Groonga is fast!", "date": "2016-05-19 12:00:00", "tag": "Groonga"},
+{"_key": "Mroonga is fast!", "date": "2016-05-19 12:00:01", "tag": "Mroonga"},
+{"_key": "Groonga sticker!", "date": "2016-05-19 12:00:02", "tag": "Groonga"},
+{"_key": "Rroonga is fast!", "date": "2016-05-19 12:00:03", "tag": "Rroonga"}
+]
+[[0,0.0,0.0],4]
+select Memos   --filter 'date < "2016-05-19 12:00:02"'   --slices[groonga].filter 'tag @ "Groonga"'   --slices[groonga].sort_keys 'date'   --slices[groonga].output_columns '_key, date'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "date",
+          "Time"
+        ],
+        [
+          "tag",
+          "Tags"
+        ]
+      ],
+      [
+        1,
+        "Groonga is fast!",
+        1463626800.0,
+        "Groonga"
+      ],
+      [
+        2,
+        "Mroonga is fast!",
+        1463626801.0,
+        "Mroonga"
+      ]
+    ],
+    {
+      "groonga": [
+        [
+          1
+        ],
+        [
+          [
+            "_key",
+            "ShortText"
+          ],
+          [
+            "date",
+            "Time"
+          ]
+        ],
+        [
+          "Groonga is fast!",
+          1463626800.0
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/select/slices/index/filtered.test (+21 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/slices/index/filtered.test    2016-05-26 09:38:55 +0900 (07e0a96)
@@ -0,0 +1,21 @@
+table_create Tags TABLE_PAT_KEY ShortText
+
+table_create Memos TABLE_HASH_KEY ShortText
+column_create Memos date COLUMN_SCALAR Time
+column_create Memos tag COLUMN_SCALAR Tags
+
+column_create Tags memos_tag COLUMN_INDEX Memos tag
+
+load --table Memos
+[
+{"_key": "Groonga is fast!", "date": "2016-05-19 12:00:00", "tag": "Groonga"},
+{"_key": "Mroonga is fast!", "date": "2016-05-19 12:00:01", "tag": "Mroonga"},
+{"_key": "Groonga sticker!", "date": "2016-05-19 12:00:02", "tag": "Groonga"},
+{"_key": "Rroonga is fast!", "date": "2016-05-19 12:00:03", "tag": "Rroonga"}
+]
+
+select Memos \
+  --filter 'date < "2016-05-19 12:00:02"' \
+  --slices[groonga].filter 'tag @ "Groonga"' \
+  --slices[groonga].sort_keys 'date' \
+  --slices[groonga].output_columns '_key, date'
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る