[Groonga-commit] groonga/groonga at 026ab29 [master] Break sequential search loop as soon as error is occurred

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Nov 19 21:49:37 JST 2014


Kouhei Sutou	2014-11-19 21:49:37 +0900 (Wed, 19 Nov 2014)

  New Revision: 026ab296a55eff8861024f6056d777e960e96f6d
  https://github.com/groonga/groonga/commit/026ab296a55eff8861024f6056d777e960e96f6d

  Message:
    Break sequential search loop as soon as error is occurred

  Modified files:
    lib/expr.c
    test/command/suite/select/filter/invalid/binary_operation/vector.expected

  Modified: lib/expr.c (+12 -0)
===================================================================
--- lib/expr.c    2014-11-19 19:18:22 +0900 (6823d50)
+++ lib/expr.c    2014-11-19 21:49:37 +0900 (8f69b0c)
@@ -5013,6 +5013,9 @@ grn_table_select_(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_obj *v,
       while ((id = grn_table_cursor_next(ctx, tc))) {
         GRN_RECORD_SET(ctx, v, id);
         r = grn_expr_exec(ctx, expr, 0);
+        if (ctx->rc) {
+          break;
+        }
         score = exec_result_to_score(ctx, r, &score_buffer);
         if (score > 0) {
           grn_rset_recinfo *ri;
@@ -5030,6 +5033,9 @@ grn_table_select_(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_obj *v,
         grn_hash_cursor_get_key(ctx, hc, (void **) &idp);
         GRN_RECORD_SET(ctx, v, *idp);
         r = grn_expr_exec(ctx, expr, 0);
+        if (ctx->rc) {
+          break;
+        }
         score = exec_result_to_score(ctx, r, &score_buffer);
         if (score > 0) {
           grn_rset_recinfo *ri;
@@ -5048,6 +5054,9 @@ grn_table_select_(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_obj *v,
         grn_hash_cursor_get_key(ctx, hc, (void **) &idp);
         GRN_RECORD_SET(ctx, v, *idp);
         r = grn_expr_exec(ctx, expr, 0);
+        if (ctx->rc) {
+          break;
+        }
         score = exec_result_to_score(ctx, r, &score_buffer);
         if (score > 0) {
           grn_hash_cursor_delete(ctx, hc, NULL);
@@ -5062,6 +5071,9 @@ grn_table_select_(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_obj *v,
         grn_hash_cursor_get_key(ctx, hc, (void **) &idp);
         GRN_RECORD_SET(ctx, v, *idp);
         r = grn_expr_exec(ctx, expr, 0);
+        if (ctx->rc) {
+          break;
+        }
         score = exec_result_to_score(ctx, r, &score_buffer);
         if (score > 0) {
           grn_rset_recinfo *ri;

  Modified: test/command/suite/select/filter/invalid/binary_operation/vector.expected (+1 -2)
===================================================================
--- test/command/suite/select/filter/invalid/binary_operation/vector.expected    2014-11-19 19:18:22 +0900 (b301a11)
+++ test/command/suite/select/filter/invalid/binary_operation/vector.expected    2014-11-19 21:49:37 +0900 (445c174)
@@ -22,11 +22,10 @@ select Memos   --filter 'tags + "groonga"'   --output_columns _key,_score
       0.0,
       0.0
     ],
-    "<+> doesn't support vector: <[{\"value\":\"mroonga\", \"weight\":0}]> + <\"groonga\">"
+    "<+> doesn't support vector: <[{\"value\":\"groonga\", \"weight\":0}]> + <\"groonga\">"
   ],
   [
 
   ]
 ]
 #|e| <+> doesn't support vector: <[{"value":"groonga", "weight":0}]> + <"groonga">
-#|e| <+> doesn't support vector: <[{"value":"mroonga", "weight":0}]> + <"groonga">
-------------- next part --------------
HTML����������������������������...
下載 



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