[Groonga-commit] groonga/groonga at c34e7cd [master] sub_filter: fix too much score with a too filtered case

Back to archive index

Yasuhiro Horimoto null+****@clear*****
Mon Jun 4 13:16:56 JST 2018


Yasuhiro Horimoto	2018-06-04 13:16:56 +0900 (Mon, 04 Jun 2018)

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

  Merged 03fd924: Merge pull request #849 from komainu8/fix_too_much_score

  Message:
    sub_filter: fix too much score with a too filtered case

  Modified files:
    lib/proc.c
    test/command/suite/select/function/sub_filter/and/match.expected
    test/command/suite/select/function/sub_filter/and/match.test

  Modified: lib/proc.c (+9 -0)
===================================================================
--- lib/proc.c    2018-05-30 09:45:09 +0900 (6274befcb)
+++ lib/proc.c    2018-06-04 13:16:56 +0900 (9c3d9c3ff)
@@ -2370,6 +2370,15 @@ run_sub_filter(grn_ctx *ctx, grn_obj *table,
                                 GRN_OBJ_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC,
                                 scope_domain, NULL);
     if (op == GRN_OP_AND && sub_filter_pre_filter(ctx, res, scope, base_res)) {
+      if (base_res) {
+        void *key = NULL, *value = NULL;
+        uint32_t key_size = 0;
+
+        GRN_TABLE_EACH(ctx, base_res, 0, 0, id, &key, &key_size, &value, {
+          grn_rset_recinfo *ri = value;
+          ri->score = 0;
+        });
+      }
       select_op = GRN_OP_AND;
     }
     grn_table_select(ctx, scope_domain, sub_filter, base_res, select_op);

  Modified: test/command/suite/select/function/sub_filter/and/match.expected (+6 -1)
===================================================================
--- test/command/suite/select/function/sub_filter/and/match.expected    2018-05-30 09:45:09 +0900 (b9a8ad56f)
+++ test/command/suite/select/function/sub_filter/and/match.expected    2018-06-04 13:16:56 +0900 (ad7c5a06e)
@@ -33,7 +33,7 @@ load --table Packages
 {"_key": "mroonga", "files": ["ha_mroonga.cc", "ha_mroonga.hpp"]}
 ]
 [[0,0.0,0.0],3]
-select Packages   --filter '_key @ "rroonga" && sub_filter(files, "revision >= 10 && revision < 40")'   --output_columns '_key, files, files.revision'
+select Packages   --filter '_key @ "rroonga" && sub_filter(files, "revision >= 10 && revision < 40")'   --output_columns '_key, _score, files, files.revision'
 [
   [
     0,
@@ -51,6 +51,10 @@ select Packages   --filter '_key @ "rroonga" && sub_filter(files, "revision >= 1
           "ShortText"
         ],
         [
+          "_score",
+          "Int32"
+        ],
+        [
           "files",
           "Files"
         ],
@@ -61,6 +65,7 @@ select Packages   --filter '_key @ "rroonga" && sub_filter(files, "revision >= 1
       ],
       [
         "rroonga",
+        5,
         [
           "lib/groonga.rb",
           "README.textile"

  Modified: test/command/suite/select/function/sub_filter/and/match.test (+1 -1)
===================================================================
--- test/command/suite/select/function/sub_filter/and/match.test    2018-05-30 09:45:09 +0900 (a0202e672)
+++ test/command/suite/select/function/sub_filter/and/match.test    2018-06-04 13:16:56 +0900 (6a3ed581e)
@@ -32,4 +32,4 @@ load --table Packages
 
 select Packages \
   --filter '_key @ "rroonga" && sub_filter(files, "revision >= 10 && revision < 40")' \
-  --output_columns '_key, files, files.revision'
+  --output_columns '_key, _score, files, files.revision'
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180604/63f6b239/attachment-0001.htm 



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