[Groonga-commit] groonga/groonga at eec6c9f [master] snippet_full: allow doesn't use any normalizer

Back to archive index

naoa null+****@clear*****
Sat Feb 20 18:58:20 JST 2016


naoa	2016-02-20 18:58:20 +0900 (Sat, 20 Feb 2016)

  New Revision: eec6c9ffa0373658e6a05f1f75b9867b343e8c75
  https://github.com/groonga/groonga/commit/eec6c9ffa0373658e6a05f1f75b9867b343e8c75

  Merged e9cbb5d: Merge pull request #486 from naoa/allow-normalizer-none

  Message:
    snippet_full: allow doesn't use any normalizer

  Added files:
    test/command/suite/select/function/snippet_full/no_normalizer.expected
    test/command/suite/select/function/snippet_full/no_normalizer.test
  Modified files:
    lib/proc/proc_snippet.c

  Modified: lib/proc/proc_snippet.c (+2 -2)
===================================================================
--- lib/proc/proc_snippet.c    2016-02-20 18:46:47 +0900 (df09f35)
+++ lib/proc/proc_snippet.c    2016-02-20 18:58:20 +0900 (38909b3)
@@ -265,9 +265,9 @@ func_snippet_full(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_d
       if (snip) {
         grn_rc rc;
         unsigned int i;
-        if (!normalizer_name_length) {
+        if (!normalizer_name) {
           grn_snip_set_normalizer(ctx, snip, GRN_NORMALIZER_AUTO);
-        } else {
+        } else if (normalizer_name_length) {
           grn_obj *normalizer;
           normalizer = grn_ctx_get(ctx, normalizer_name, normalizer_name_length);
           if (!grn_obj_is_normalizer_proc(ctx, normalizer)) {

  Added: test/command/suite/select/function/snippet_full/no_normalizer.expected (+35 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/snippet_full/no_normalizer.expected    2016-02-20 18:58:20 +0900 (d784787)
@@ -0,0 +1,35 @@
+table_create Entries TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Entries content COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Entries
+[
+{"content": "MySQL is a kind of sql database server"}
+]
+[[0,0.0,0.0],1]
+select Entries   --output_columns '   snippet_full(content,   "sql", "<span class=\\"keyword\\">", "</span>",   {"normalizer": ""}   )'   --command_version 2
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        1
+      ],
+      [
+        [
+          "snippet_full",
+          "null"
+        ]
+      ],
+      [
+        [
+          "MySQL is a kind of <span class=\"keyword\">sql</span> database server"
+        ]
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/snippet_full/no_normalizer.test (+15 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/snippet_full/no_normalizer.test    2016-02-20 18:58:20 +0900 (342e077)
@@ -0,0 +1,15 @@
+table_create Entries TABLE_NO_KEY
+column_create Entries content COLUMN_SCALAR ShortText
+
+load --table Entries
+[
+{"content": "MySQL is a kind of sql database server"}
+]
+
+select Entries \
+  --output_columns ' \
+  snippet_full(content, \
+  "sql", "<span class=\\"keyword\\">", "</span>", \
+  {"normalizer": ""} \
+  )' \
+  --command_version 2
-------------- next part --------------
HTML����������������������������...
Download 



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