[Groonga-commit] groonga/groonga at 7649558 [master] Swap clause order

Back to archive index

Kouhei Sutou null+****@clear*****
Tue May 15 16:01:55 JST 2018


Kouhei Sutou	2018-05-15 16:01:55 +0900 (Tue, 15 May 2018)

  New Revision: 7649558dae087810b627386d6d996de7575d3cea
  https://github.com/groonga/groonga/commit/7649558dae087810b627386d6d996de7575d3cea

  Message:
    Swap clause order

  Modified files:
    lib/proc.c

  Modified: lib/proc.c (+23 -23)
===================================================================
--- lib/proc.c    2018-05-15 15:47:20 +0900 (3a4d21f7e)
+++ lib/proc.c    2018-05-15 16:01:55 +0900 (231e5374e)
@@ -2117,55 +2117,55 @@ sub_filter_pre_filter(grn_ctx *ctx,
     return GRN_FALSE;
   }
 
-  if (grn_obj_is_vector_column(ctx, scope)) {
-    grn_obj values;
+  if (grn_obj_is_scalar_column(ctx, scope)) {
+    grn_obj value;
 
     memset(&posting, 0, sizeof(grn_posting));
-    GRN_RECORD_INIT(&values, GRN_OBJ_VECTOR, grn_obj_get_range(ctx, scope));
+    GRN_RECORD_INIT(&value, 0, grn_obj_get_range(ctx, scope));
     GRN_TABLE_EACH_BEGIN(ctx, res, cursor, id) {
       grn_id *matched_id;
-      unsigned int i, n;
 
       grn_table_cursor_get_key(ctx, cursor, (void **)&matched_id);
-      GRN_BULK_REWIND(&values);
-      grn_obj_get_value(ctx, scope, *matched_id, &values);
-      n = grn_vector_size(ctx, &values);
-      for (i = 0; i < n; i++) {
-        posting.rid = grn_uvector_get_element(ctx,
-                                              &values,
-                                              i,
-                                              &(posting.weight));
+      GRN_BULK_REWIND(&value);
+      grn_obj_get_value(ctx, scope, *matched_id, &value);
+      if (GRN_BULK_VSIZE(&value) > 0) {
+        posting.rid = GRN_RECORD_VALUE(&value);
         grn_ii_posting_add(ctx, &posting, (grn_hash *)base_res, GRN_OP_OR);
       }
     } GRN_TABLE_EACH_END(ctx, cursor);
-    GRN_OBJ_FIN(ctx, &values);
+    GRN_OBJ_FIN(ctx, &value);
 
     grn_report_column(ctx,
                       "[sub_filter][pre-filter]",
-                      "[vector]",
+                      "[scalar]",
                       scope);
     return GRN_TRUE;
-  } else if (grn_obj_is_scalar_column(ctx, scope)) {
-    grn_obj value;
+  } else if (grn_obj_is_vector_column(ctx, scope)) {
+    grn_obj values;
 
     memset(&posting, 0, sizeof(grn_posting));
-    GRN_RECORD_INIT(&value, 0, grn_obj_get_range(ctx, scope));
+    GRN_RECORD_INIT(&values, GRN_OBJ_VECTOR, grn_obj_get_range(ctx, scope));
     GRN_TABLE_EACH_BEGIN(ctx, res, cursor, id) {
       grn_id *matched_id;
+      unsigned int i, n;
 
       grn_table_cursor_get_key(ctx, cursor, (void **)&matched_id);
-      GRN_BULK_REWIND(&value);
-      grn_obj_get_value(ctx, scope, *matched_id, &value);
-      if (GRN_BULK_VSIZE(&value) > 0) {
-        posting.rid = GRN_RECORD_VALUE(&value);
+      GRN_BULK_REWIND(&values);
+      grn_obj_get_value(ctx, scope, *matched_id, &values);
+      n = grn_vector_size(ctx, &values);
+      for (i = 0; i < n; i++) {
+        posting.rid = grn_uvector_get_element(ctx,
+                                              &values,
+                                              i,
+                                              &(posting.weight));
         grn_ii_posting_add(ctx, &posting, (grn_hash *)base_res, GRN_OP_OR);
       }
     } GRN_TABLE_EACH_END(ctx, cursor);
-    GRN_OBJ_FIN(ctx, &value);
+    GRN_OBJ_FIN(ctx, &values);
 
     grn_report_column(ctx,
                       "[sub_filter][pre-filter]",
-                      "[scalar]",
+                      "[vector]",
                       scope);
     return GRN_TRUE;
   } else {
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180515/6bff21c0/attachment-0001.htm 



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