[Groonga-commit] groonga/groonga at 1291b60 [master] Use ii functions to resolve search results by nested index search

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jan 14 12:28:30 JST 2014


Kouhei Sutou	2014-01-14 12:28:30 +0900 (Tue, 14 Jan 2014)

  New Revision: 1291b60008333d5aef006720cbcb5978157d485d
  https://github.com/groonga/groonga/commit/1291b60008333d5aef006720cbcb5978157d485d

  Message:
    Use ii functions to resolve search results by nested index search
    
    It fixes the following test broken by
    89c5576a310aa86783804f959285874ac388d117:
    
      * test/command/suite/select/index/nested/by_column/match/and.test
    
    Detail:
    
        [30] select/index/nested/by_column/match
          and                                                           1.0461s [failed]
        ================================================================================
        --- (expected)
        +++ (actual)
        @@ -29,35 +29,30 @@
          select Files   --filter '_key @^ "/home/" && owner.hobby @ "programming"'   --output_columns '_key, owner, owner.hobby'
          [
            [
              0,
              0.0,
              0.0
            ],
            [
              [
                [
        ?         1
        ?         0
                ],
                [
                  [
                    "_key",
                    "ShortText"
                  ],
                  [
                    "owner",
                    "Users"
                  ],
                  [
                    "owner.hobby",
                    "ShortText"
                  ]
        -       ],
        -       [
        -         "/home/alice/.zshrc",
        -         "Alice",
        -         "programming"
                ]
              ]
            ]
          ]
    
    See also: https://travis-ci.org/groonga/groonga/jobs/16860080

  Modified files:
    lib/db.c

  Modified: lib/db.c (+11 -6)
===================================================================
--- lib/db.c    2014-01-14 10:27:39 +0900 (a7b416b)
+++ lib/db.c    2014-01-14 12:28:30 +0900 (8f5f7e7)
@@ -2798,12 +2798,17 @@ grn_obj_search_accessor(grn_ctx *ctx, grn_obj *obj, grn_obj *query,
       rc = grn_accessor_resolve(ctx, obj, n_accessors - 1, base_res,
                                 &resolve_res, optarg);
       if (resolve_res) {
-        if (op == GRN_OP_AND) {
-          grn_table_setoperation(ctx, res, resolve_res, res, GRN_OP_OR);
-          grn_ii_resolve_sel_and(ctx, (grn_hash *)res, op);
-        } else {
-          grn_table_setoperation(ctx, res, resolve_res, res, op);
-        }
+        grn_id *record_id;
+        grn_rset_recinfo *recinfo;
+        GRN_HASH_EACH(ctx, (grn_hash *)resolve_res, id, &record_id, NULL,
+                      &recinfo, {
+          grn_ii_posting posting;
+          posting.rid = *record_id;
+          posting.sid = 1;
+          posting.weight = recinfo->score - 1;
+          grn_ii_posting_add(ctx, &posting, (grn_hash *)res, op);
+        });
+        grn_ii_resolve_sel_and(ctx, (grn_hash *)res, op);
         grn_obj_unlink(ctx, resolve_res);
       }
       grn_obj_unlink(ctx, base_res);
-------------- next part --------------
HTML����������������������������...
Download 



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