[Groonga-commit] groonga/groonga at 4d425e9 [master] Improve error message on query expansion

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jun 15 15:05:14 JST 2016


Kouhei Sutou	2016-06-15 15:05:14 +0900 (Wed, 15 Jun 2016)

  New Revision: 4d425e9053b6f02d85292d7cba2662d0abf86135
  https://github.com/groonga/groonga/commit/4d425e9053b6f02d85292d7cba2662d0abf86135

  Message:
    Improve error message on query expansion

  Modified files:
    lib/grn_proc.h
    lib/proc.c
    lib/proc/proc_select.c
    test/command/suite/plugin_unregister/existence.expected
    test/command/suite/select/query_expander/column/nonexistent_expansion_column.expected

  Modified: lib/grn_proc.h (+2 -1)
===================================================================
--- lib/grn_proc.h    2016-06-15 10:37:32 +0900 (257c5e3)
+++ lib/grn_proc.h    2016-06-15 15:05:14 +0900 (d91043f)
@@ -116,7 +116,8 @@ grn_rc grn_proc_syntax_expand_query(grn_ctx *ctx,
                                     grn_expr_flags flags,
                                     const char *query_expander_name,
                                     unsigned int query_expander_name_len,
-                                    grn_obj *expanded_query);
+                                    grn_obj *expanded_query,
+                                    const char *error_message_tag);
 
 #ifdef __cplusplus
 }

  Modified: lib/proc.c (+2 -1)
===================================================================
--- lib/proc.c    2016-06-15 10:37:32 +0900 (ad077df)
+++ lib/proc.c    2016-06-15 15:05:14 +0900 (0f27426)
@@ -2494,7 +2494,8 @@ run_query(grn_ctx *ctx, grn_obj *table,
                                         flags,
                                         GRN_TEXT_VALUE(query_expander_name),
                                         GRN_TEXT_LEN(query_expander_name),
-                                        &expanded_query);
+                                        &expanded_query,
+                                        "[query]");
       if (rc != GRN_SUCCESS) {
         GRN_OBJ_FIN(ctx, &expanded_query);
         goto exit;

  Modified: lib/proc/proc_select.c (+6 -3)
===================================================================
--- lib/proc/proc_select.c    2016-06-15 10:37:32 +0900 (8c0f9ee)
+++ lib/proc/proc_select.c    2016-06-15 15:05:14 +0900 (1e7af24)
@@ -183,7 +183,8 @@ grn_proc_syntax_expand_query(grn_ctx *ctx,
                              grn_expr_flags flags,
                              const char *query_expander_name,
                              unsigned int query_expander_name_len,
-                             grn_obj *expanded_query)
+                             grn_obj *expanded_query,
+                             const char *error_message_tag)
 {
   grn_obj *query_expander;
 
@@ -193,7 +194,8 @@ grn_proc_syntax_expand_query(grn_ctx *ctx,
   if (!query_expander) {
     GRN_PLUGIN_ERROR(ctx,
                      GRN_INVALID_ARGUMENT,
-                     "nonexistent query expansion column: <%.*s>",
+                     "%s nonexistent query expander: <%.*s>",
+                     error_message_tag,
                      query_expander_name_len, query_expander_name);
     return ctx->rc;
   }
@@ -1188,7 +1190,8 @@ grn_select_filter(grn_ctx *ctx,
                                         flags,
                                         data->query_expander.value,
                                         data->query_expander.length,
-                                        &query_expander_buf);
+                                        &query_expander_buf,
+                                        "[select]");
       if (rc == GRN_SUCCESS) {
         query = GRN_TEXT_VALUE(&query_expander_buf);
         query_len = GRN_TEXT_LEN(&query_expander_buf);

  Modified: test/command/suite/plugin_unregister/existence.expected (+2 -2)
===================================================================
--- test/command/suite/plugin_unregister/existence.expected    2016-06-15 10:37:32 +0900 (6332dad)
+++ test/command/suite/plugin_unregister/existence.expected    2016-06-15 15:05:14 +0900 (57f7e9f)
@@ -47,5 +47,5 @@ select --table Memos --query_expander QueryExpanderTSV   --match_columns content
 plugin_unregister "query_expanders/tsv"
 [[0,0.0,0.0],true]
 select --table Memos --query_expander QueryExpanderTSV   --match_columns content --query rroonga
-[[[-22,0.0,0.0],"nonexistent query expansion column: <QueryExpanderTSV>"]]
-#|e| nonexistent query expansion column: <QueryExpanderTSV>
+[[[-22,0.0,0.0],"[select] nonexistent query expander: <QueryExpanderTSV>"]]
+#|e| [select] nonexistent query expander: <QueryExpanderTSV>

  Modified: test/command/suite/select/query_expander/column/nonexistent_expansion_column.expected (+2 -2)
===================================================================
--- test/command/suite/select/query_expander/column/nonexistent_expansion_column.expected    2016-06-15 10:37:32 +0900 (c4503ac)
+++ test/command/suite/select/query_expander/column/nonexistent_expansion_column.expected    2016-06-15 15:05:14 +0900 (d4eaef0)
@@ -14,7 +14,7 @@ select --table Memos --query_expander Nonexistent.nonexistent   --match_columns
       0.0,
       0.0
     ],
-    "nonexistent query expansion column: <Nonexistent.nonexistent>"
+    "[select] nonexistent query expander: <Nonexistent.nonexistent>"
   ]
 ]
-#|e| nonexistent query expansion column: <Nonexistent.nonexistent>
+#|e| [select] nonexistent query expander: <Nonexistent.nonexistent>
-------------- next part --------------
HTML����������������������������...
Download 



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