Kouhei Sutou 2019-02-12 17:53:34 +0900 (Tue, 12 Feb 2019) Revision: cab0b079018aa1238f5cc9f2d60567704d402b39 https://github.com/groonga/groonga/commit/cab0b079018aa1238f5cc9f2d60567704d402b39 Message: snippet, snippet_html: return an empty vector for no match Modified files: lib/proc/proc_snippet.c test/command/suite/select/function/snippet_html/none.expected Modified: lib/proc/proc_snippet.c (+5 -4) =================================================================== --- lib/proc/proc_snippet.c 2019-02-12 17:40:42 +0900 (f98438d67) +++ lib/proc/proc_snippet.c 2019-02-12 17:53:34 +0900 (10052b39b) @@ -1,6 +1,7 @@ /* -*- c-basic-offset: 2 -*- */ /* Copyright(C) 2009-2016 Brazil + Copyright(C) 2019 Kouhei Sutou <kou****@clear*****> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -46,15 +47,15 @@ snippet_exec(grn_ctx *ctx, grn_obj *snip, grn_obj *text, return NULL; } - if (n_results == 0) { - return grn_plugin_proc_alloc(ctx, user_data, GRN_DB_VOID, 0); - } - snippets = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_SHORT_TEXT, GRN_OBJ_VECTOR); if (!snippets) { return NULL; } + if (n_results == 0) { + return snippets; + } + GRN_TEXT_INIT(&snippet_buffer, 0); grn_bulk_space(ctx, &snippet_buffer, prefix_length + max_tagged_length + suffix_length); Modified: test/command/suite/select/function/snippet_html/none.expected (+3 -1) =================================================================== --- test/command/suite/select/function/snippet_html/none.expected 2019-02-12 17:40:42 +0900 (7654328bb) +++ test/command/suite/select/function/snippet_html/none.expected 2019-02-12 17:53:34 +0900 (721e507cf) @@ -36,7 +36,9 @@ select Documents --match_columns content --query 'MySQL' --output_columns '_ ], [ "Groonga", - null + [ + + ] ] ] ] -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190212/ce98998c/attachment-0001.html>