[Groonga-commit] groonga/groonga at 12a9a8a [master] expr: fix a bug that extra scores were added

Back to archive index

Yasuhiro Horimoto null+****@clear*****
Tue May 22 17:56:31 JST 2018


Yasuhiro Horimoto	2018-05-22 17:56:31 +0900 (Tue, 22 May 2018)

  New Revision: 12a9a8a96b51e704e89460d34b5d4696f49d4a85
  https://github.com/groonga/groonga/commit/12a9a8a96b51e704e89460d34b5d4696f49d4a85

  Merged 50cff5a: Merge pull request #846 from komainu8/fix_wrong_score

  Message:
    expr: fix a bug that extra scores were added

  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+11 -1)
===================================================================
--- lib/expr.c    2018-05-22 14:04:19 +0900 (3a7194a77)
+++ lib/expr.c    2018-05-22 17:56:31 +0900 (27d0e2c83)
@@ -4836,7 +4836,17 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
                                       table,
                                       NULL);
           if (base_res) {
-            grn_table_setoperation(ctx, base_res, res, base_res, GRN_OP_OR);
+            void *key = NULL, *value = NULL, *base_value = NULL;
+            uint32_t key_size = 0;
+
+            GRN_TABLE_EACH(ctx, res, 0, 0, id, &key, &key_size, &value, {
+              if (grn_table_add_v(ctx, base_res, key, key_size, &base_value, NULL)) {
+                grn_rset_recinfo *ri = value;
+                grn_rset_recinfo *base_ri = base_value;
+                grn_memcpy(base_ri, ri, ((grn_hash *)base_res)->value_size);
+                base_ri->score--;
+              }
+            });
           }
         }
       }
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180522/2c22f00e/attachment.htm 



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