[Groonga-commit] groonga/groonga at 47f167a [master] query_expand: fix a bug that the default flags are NONE

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Wed Dec 28 17:15:55 JST 2016


Kouhei Sutou	2016-12-28 17:15:55 +0900 (Wed, 28 Dec 2016)

  New Revision: 47f167ab275c51cbf9c78a2dfd2488c36eec7d60
  https://github.com/groonga/groonga/commit/47f167ab275c51cbf9c78a2dfd2488c36eec7d60

  Message:
    query_expand: fix a bug that the default flags are NONE

  Modified files:
    lib/proc/proc_query.c
    test/command/suite/query_expand/proc.expected
    test/command/suite/query_expand/proc.test

  Modified: lib/proc/proc_query.c (+9 -4)
===================================================================
--- lib/proc/proc_query.c    2016-12-28 16:18:51 +0900 (5f9e5a0)
+++ lib/proc/proc_query.c    2016-12-28 17:15:55 +0900 (cdbe652)
@@ -49,10 +49,15 @@ command_query_expand(grn_ctx *ctx, int nargs, grn_obj **args,
                                              -1,
                                              &flags_raw_size);
 
-  flags |= grn_proc_expr_query_flags_parse(ctx,
-                                           flags_raw,
-                                           flags_raw_size,
-                                           "[query][expand]");
+  if (flags_raw_size > 0) {
+    flags |= grn_proc_expr_query_flags_parse(ctx,
+                                             flags_raw,
+                                             flags_raw_size,
+                                             "[query][expand]");
+  } else {
+    flags |= GRN_EXPR_ALLOW_PRAGMA | GRN_EXPR_ALLOW_COLUMN;
+  }
+
   if (ctx->rc != GRN_SUCCESS) {
     return NULL;
   }

  Modified: test/command/suite/query_expand/proc.expected (+9 -2)
===================================================================
--- test/command/suite/query_expand/proc.expected    2016-12-28 16:18:51 +0900 (24cb7e3)
+++ test/command/suite/query_expand/proc.expected    2016-12-28 17:15:55 +0900 (41fe4fa)
@@ -1,4 +1,11 @@
 plugin_register "query_expanders/tsv"
 [[0,0.0,0.0],true]
-query_expand QueryExpanderTSV rroonga
-[[0,0.0,0.0],"((rroonga) OR (Ruby groonga))"]
+query_expand QueryExpanderTSV "rroonga column:rroonga"
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  "((rroonga) OR (Ruby groonga)) column:((rroonga) OR (Ruby groonga))"
+]

  Modified: test/command/suite/query_expand/proc.test (+1 -1)
===================================================================
--- test/command/suite/query_expand/proc.test    2016-12-28 16:18:51 +0900 (5fd02de)
+++ test/command/suite/query_expand/proc.test    2016-12-28 17:15:55 +0900 (f38c6c9)
@@ -2,4 +2,4 @@
 #@copy-path fixture/query_expander/tsv/expand.tsv tmp/synonyms.tsv
 plugin_register "query_expanders/tsv"
 
-query_expand QueryExpanderTSV rroonga
+query_expand QueryExpanderTSV "rroonga column:rroonga"
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る