Kouhei Sutou
null+****@clear*****
Tue Feb 4 13:16:34 JST 2014
Kouhei Sutou 2014-02-04 13:16:34 +0900 (Tue, 04 Feb 2014) New Revision: ae8207299e2c9c378008361ae073456b2f47b07a https://github.com/groonga/groonga/commit/ae8207299e2c9c378008361ae073456b2f47b07a Message: snippet_html: suppress ALERT level message for empty text [groonga-dev,02097] Reported by Naoya Murakami. Thanks!!! Added files: test/command/suite/select/function/snippet_html/empty_text.expected test/command/suite/select/function/snippet_html/empty_text.test Modified files: lib/proc.c Modified: lib/proc.c (+4 -0) =================================================================== --- lib/proc.c 2014-02-04 13:12:33 +0900 (a3e3a43) +++ lib/proc.c 2014-02-04 13:16:34 +0900 (9dc0e59) @@ -3647,6 +3647,10 @@ snippet_exec(grn_ctx *ctx, grn_obj *snip, grn_obj *text, grn_obj snippet_buffer; grn_obj *snippets; + if (GRN_TEXT_LEN(text) == 0) { + return NULL; + } + rc = grn_snip_exec(ctx, snip, GRN_TEXT_VALUE(text), GRN_TEXT_LEN(text), &n_results, &max_tagged_length); Added: test/command/suite/select/function/snippet_html/empty_text.expected (+16 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/snippet_html/empty_text.expected 2014-02-04 13:16:34 +0900 (6b5bb45) @@ -0,0 +1,16 @@ +table_create Documents TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Documents content COLUMN_SCALAR Text +[[0,0.0,0.0],true] +table_create Terms TABLE_PAT_KEY|KEY_NORMALIZE ShortText --default_tokenizer TokenBigram +[[0,0.0,0.0],true] +column_create Terms document_index COLUMN_INDEX|WITH_POSITION Documents content +[[0,0.0,0.0],true] +load --table Documents +[ +["_key", "content"], +["About Groonga", "Groonga is an open-source fulltext search engine and column store. It lets you write high-performance applications that requires fulltext search."] +] +[[0,0.0,0.0],1] +select Documents --match_columns content --query 'Groonga' --output_columns 'snippet_html("")' --command_version 2 +[[0,0.0,0.0],[[[1],[["snippet_html","null"]],[null]]]] Added: test/command/suite/select/function/snippet_html/empty_text.test (+16 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/snippet_html/empty_text.test 2014-02-04 13:16:34 +0900 (c716b85) @@ -0,0 +1,16 @@ +table_create Documents TABLE_HASH_KEY ShortText +column_create Documents content COLUMN_SCALAR Text + +table_create Terms TABLE_PAT_KEY|KEY_NORMALIZE ShortText --default_tokenizer TokenBigram +column_create Terms document_index COLUMN_INDEX|WITH_POSITION Documents content + +load --table Documents +[ +["_key", "content"], +["About Groonga", "Groonga is an open-source fulltext search engine and column store. It lets you write high-performance applications that requires fulltext search."] +] + +select Documents \ + --match_columns content --query 'Groonga' \ + --output_columns 'snippet_html("")' \ + --command_version 2 -------------- next part -------------- HTML����������������������������...Download