[Groonga-mysql-commit] mroonga/mroonga at 5b2ecbe [master] highlight_html: support normalizer

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Jul 27 23:11:34 JST 2017


Kouhei Sutou	2017-07-27 23:11:34 +0900 (Thu, 27 Jul 2017)

  New Revision: 5b2ecbe3d0d9c424bba913d92a15eb71597ffbe4
  https://github.com/mroonga/mroonga/commit/5b2ecbe3d0d9c424bba913d92a15eb71597ffbe4

  Message:
    highlight_html: support normalizer

  Added files:
    mysql-test/mroonga/storage/function/highlight_html/r/normalizer.result
    mysql-test/mroonga/storage/function/highlight_html/t/normalizer.test
  Modified files:
    udf/mrn_udf_highlight_html.cpp

  Added: mysql-test/mroonga/storage/function/highlight_html/r/normalizer.result (+4 -0) 100644
===================================================================
--- /dev/null
+++ mysql-test/mroonga/storage/function/highlight_html/r/normalizer.result    2017-07-27 23:11:34 +0900 (bf280db)
@@ -0,0 +1,4 @@
+SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.',
+'mroonga') AS highlighted;
+highlighted
+<span class="keyword">Mroonga</span> is the Groonga based storage engine.

  Added: mysql-test/mroonga/storage/function/highlight_html/t/normalizer.test (+25 -0) 100644
===================================================================
--- /dev/null
+++ mysql-test/mroonga/storage/function/highlight_html/t/normalizer.test    2017-07-27 23:11:34 +0900 (a0b63fc)
@@ -0,0 +1,25 @@
+# Copyright(C) 2017 Kouhei Sutou <kou �� clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+--source include/not_embedded.inc
+--source ../../../../include/mroonga/have_mroonga.inc
+--source ../../../../include/mroonga/load_mroonga_functions.inc
+
+SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.',
+                              'mroonga') AS highlighted;
+
+--source ../../../../include/mroonga/unload_mroonga_functions.inc
+--source ../../../../include/mroonga/have_mroonga_deinit.inc

  Modified: udf/mrn_udf_highlight_html.cpp (+7 -1)
===================================================================
--- udf/mrn_udf_highlight_html.cpp    2017-07-27 14:54:12 +0900 (0a871a8)
+++ udf/mrn_udf_highlight_html.cpp    2017-07-27 23:11:34 +0900 (dc46ef5)
@@ -64,7 +64,7 @@ static my_bool mrn_highlight_html_prepare(mrn_highlight_html_info *info,
   *keywords = NULL;
 
   mrn::encoding::set_raw(ctx, system_charset_info);
-  if (!(system_charset_info->state & (MY_CS_BINSORT | MY_CS_CSSORT))) {
+  if (system_charset_info->state & (MY_CS_BINSORT | MY_CS_CSSORT)) {
     normalizer_name = NULL;
   }
 
@@ -81,6 +81,12 @@ static my_bool mrn_highlight_html_prepare(mrn_highlight_html_info *info,
     }
     goto error;
   }
+  if (normalizer_name) {
+    grn_obj_set_info(ctx,
+                     *keywords,
+                     GRN_INFO_NORMALIZER,
+                     grn_ctx_get(ctx, normalizer_name, -1));
+  }
 
   if (info->query_mode.used) {
     if (!info->query_mode.table) {
-------------- next part --------------
HTML����������������������������...
다운로드 



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