[Groonga-commit] groonga/groonga at 3ea76c9 [master] TokenFilterStopWord: fix a bug that an error occurs when executing a query with a column option

Back to archive index
Yasuhiro Horimoto null+****@clear*****
Tue Nov 13 16:19:38 JST 2018


Yasuhiro Horimoto	2018-11-13 16:19:38 +0900 (Tue, 13 Nov 2018)

  Revision: 3ea76c97025dedee4c00e98614e71eb3662dce69
  https://github.com/groonga/groonga/commit/3ea76c97025dedee4c00e98614e71eb3662dce69

  Merged 42c6aaa: Merge pull request #881 from komainu8/fix_a_bug_tokenfilterstopword

  Message:
    TokenFilterStopWord: fix a bug that an error occurs when executing a query with a column option

  Added files:
    test/command/suite/token_filters/stop_word/column.expected
    test/command/suite/token_filters/stop_word/column.test
  Modified files:
    plugins/token_filters/stop_word.c

  Modified: plugins/token_filters/stop_word.c (+1 -1)
===================================================================
--- plugins/token_filters/stop_word.c    2018-11-13 11:05:43 +0900 (782f67dca)
+++ plugins/token_filters/stop_word.c    2018-11-13 16:19:38 +0900 (e1819ed4e)
@@ -81,7 +81,7 @@ stop_word_open_options(grn_ctx *ctx,
                                       &column,
                                       NULL,
                                       NULL);
-      GRN_TEXT_SET(ctx, &(options->column), name, length);
+      GRN_TEXT_SET(ctx, &(options->column), column, length);
     }
   } GRN_OPTION_VALUES_EACH_END();
 

  Added: test/command/suite/token_filters/stop_word/column.expected (+57 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/token_filters/stop_word/column.expected    2018-11-13 16:19:38 +0900 (3c563762c)
@@ -0,0 +1,57 @@
+plugin_register token_filters/stop_word
+[[0,0.0,0.0],true]
+table_create Memos TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Memos content COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto --token_filters 'TokenFilterStopWord("column", "ignore")'
+[[0,0.0,0.0],true]
+column_create Terms memos_content COLUMN_INDEX|WITH_POSITION Memos content
+[[0,0.0,0.0],true]
+column_create Terms ignore COLUMN_SCALAR Bool
+[[0,0.0,0.0],true]
+load --table Terms
+[
+{"_key": "and", "ignore": true}
+]
+[[0,0.0,0.0],1]
+load --table Memos
+[
+{"content": "Hello"},
+{"content": "Hello and Good-bye"},
+{"content": "Good-bye"}
+]
+[[0,0.0,0.0],3]
+select Memos --match_columns content --query "Hello and"
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "content",
+          "ShortText"
+        ]
+      ],
+      [
+        1,
+        "Hello"
+      ],
+      [
+        2,
+        "Hello and Good-bye"
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/token_filters/stop_word/column.test (+22 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/token_filters/stop_word/column.test    2018-11-13 16:19:38 +0900 (fc4ebd34a)
@@ -0,0 +1,22 @@
+plugin_register token_filters/stop_word
+
+table_create Memos TABLE_NO_KEY
+column_create Memos content COLUMN_SCALAR ShortText
+
+table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto --token_filters 'TokenFilterStopWord("column", "ignore")'
+column_create Terms memos_content COLUMN_INDEX|WITH_POSITION Memos content
+column_create Terms ignore COLUMN_SCALAR Bool
+
+load --table Terms
+[
+{"_key": "and", "ignore": true}
+]
+
+load --table Memos
+[
+{"content": "Hello"},
+{"content": "Hello and Good-bye"},
+{"content": "Good-bye"}
+]
+
+select Memos --match_columns content --query "Hello and"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20181113/2bb117ed/attachment-0001.html>


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