naoa
null+****@clear*****
Mon Aug 11 04:32:42 JST 2014
naoa 2014-08-11 04:32:42 +0900 (Mon, 11 Aug 2014) New Revision: cb23c7c5a23d96ec50b685e3ff6db6da6dc3a87b https://github.com/groonga/groonga/commit/cb23c7c5a23d96ec50b685e3ff6db6da6dc3a87b Merged 1c5df3c: Merge pull request #186 from naoa/doc-highlight-function Message: doc: add highlight_full() Added files: doc/source/example/reference/functions/highlight_full/usage_basic.log doc/source/example/reference/functions/highlight_full/usage_setup.log doc/source/example/reference/functions/highlight_full/usage_string_literal.log doc/source/reference/functions/highlight_full.rst Modified files: doc/locale/en/LC_MESSAGES/reference.po doc/locale/ja/LC_MESSAGES/reference.po Modified: doc/locale/en/LC_MESSAGES/reference.po (+68 -0) =================================================================== --- doc/locale/en/LC_MESSAGES/reference.po 2014-08-11 04:28:32 +0900 (d2dd710) +++ doc/locale/en/LC_MESSAGES/reference.po 2014-08-11 04:32:42 +0900 (b843527) @@ -9871,6 +9871,74 @@ msgid "pointに指定した座標が矩形の範囲内にあるかどうかをBo msgstr "" "pointに指定した座標が矩形の範囲内にあるかどうかをBool型の値で返します。" +msgid "highlight_full" +msgstr "" + +msgid "" +"``highlight_full`` tags target text. It can use to highlight the search " +"keyword. It can specify use/not use HTML escape, the normalizer name and " +"change the tag for each keyword." +msgstr "" +"``highlight_full`` tags target text. It can use to highlight the search " +"keyword. It can specify use/not use HTML escape, the normalizer name and " +"change the tag for each keyword." + +msgid "``highlight_full`` has required parameter and optional parameter::" +msgstr "``highlight_full`` has required parameter and optional parameter::" + +msgid "" +"``highlight_full`` can be used in only ``--output_columns`` in :doc:`/" +"reference/commands/select`." +msgstr "" +"``highlight_full`` can be used in only ``--output_columns`` in :doc:`/" +"reference/commands/select`." + +msgid "``highlight_full`` requires Groonga 4.0.5 or later." +msgstr "``highlight_full`` requires Groonga 4.0.5 or later." + +msgid "" +"``highlight_full`` requires :doc:`/reference/command/command_version` 2 " +"or later." +msgstr "" +"``highlight_full`` requires :doc:`/reference/command/command_version` 2 " +"or later." + +msgid "" +"The following example uses HTML escape and normalzier is ``NormalizeAuto``. " +"It specifies the tags ``<span class=\"keyword1\">`` and ``</span>`` of the " +"keyword ``groonga``, and the tags ``<span class=\"keyword2\">`` and ``</span>`` " +"of the keyword ``mysql``." +msgstr "" +"The following example uses HTML escape and normalzier is ``NormalizeAuto``. " +"It specifies the tags ``<span class=\"keyword1\">`` and ``</span>`` of the " +"keyword ``groonga``, and the tags ``<span class=\"keyword2\">`` and ``</span>`` " +"of the keyword ``mysql``." + +msgid "" +"``--query \"groonga mysql\"`` matches to the first record's body. " +"``highight_full`` surrounds the keywords ``groonga`` contained in the text " +"with ``<span class=\"keyword1\">`` and ``</span>``, and the keywords ``mysql`` " +"contained in the text with with ``<span class=\"keyword2\">`` and ``</span>``." +msgstr "" +"``--query \"groonga mysql\"`` matches to the first record's body. " +"``highight_full`` surrounds the keywords ``groonga`` contained in the text " +"with ``<span class=\"keyword1\">`` and ``</span>``, and the keywords ``mysql`` " +"contained in the text with with ``<span class=\"keyword2\">`` and ``</span>``." + +msgid "" +"Special characters such as ``<`` and ``>`` are escapsed as ``<`` and " +"``>``." +msgstr "" +"Special characters such as ``<`` and ``>`` are escapsed as ``<`` and " +"``>``." + +msgid "" +"``highlight_full`` returns a tagged string or ``null``. If " +"``highlight_full`` can't find any keywords, it returns ``null``." +msgstr "" +"``highlight_full`` returns a tagged string or ``null``. If " +"``highlight_full`` can't find any keywords, it returns ``null``." + msgid "highlight_html" msgstr "" Modified: doc/locale/ja/LC_MESSAGES/reference.po (+67 -0) =================================================================== --- doc/locale/ja/LC_MESSAGES/reference.po 2014-08-11 04:28:32 +0900 (892bc9e) +++ doc/locale/ja/LC_MESSAGES/reference.po 2014-08-11 04:32:42 +0900 (38f132c) @@ -8998,6 +8998,73 @@ msgstr "" msgid "pointに指定した座標が矩形の範囲内にあるかどうかをBool型の値で返します。" msgstr "" +msgid "highlight_full" +msgstr "" + +msgid "" +"``highlight_full`` tags target text. It can use to highlight the search " +"keyword. It can specify use/not use HTML escape, the normalizer name and " +"change the tag for each keyword." +msgstr "" +"``highlight_full`` は対象テキストをタグ付けします。検索文字列をハイライト" +"させるために利用することができます。HTMLエスケープの有無、ノーマライザー名" +"を指定することができ、キーワードごとにタグを変更することができます。" + +msgid "``highlight_full`` has required parameter and optional parameter::" +msgstr "``highlight_full`` には必須引数と省略可能引数とがあります::" + +msgid "" +"``highlight_full`` can be used in only ``--output_columns`` in :doc:`/" +"reference/commands/select`." +msgstr "" +"``highlight_full`` は :doc:`/reference/commands/select` コマンドの ``--" +"output_columns`` 内でのみ指定できます。" + +msgid "``highlight_full`` requires Groonga 4.0.5 or later." +msgstr "``highlight_full`` を使うにはGroonga 4.0.5以降が必要です。" + +msgid "" +"``highlight_full`` requires :doc:`/reference/command/command_version` 2 " +"or later." +msgstr "" +"``highlight_full`` を使うには コマンドバージョン 2以降を使う必要がありま" +"す。" + +msgid "" +"The following example uses HTML escape and normalzier is ``NormalizeAuto``. " +"It specifies the tags ``<span class=\"keyword1\">`` and ``</span>`` of the " +"keyword ``groonga``, and the tags ``<span class=\"keyword2\">`` and ``</span>`` " +"of the keyword ``mysql``." +msgstr "" +"以下の例はHTMLエスケープを使用し、ノーマライザーに ``NormalizerAuto`` を指定" +"しています。この例では キーワード ``groonga`` に ``<span class=\"keyword1\">`` " +" と ``</span>`` のタグを指定し、キーワード ``mysql`` に " +"``<span class=\"keyword2\">`` と ``</span>`` のタグを指定しています。" + +msgid "" +"``--query \"groonga mysql\"`` matches to the first record's body. " +"``highight_full`` surrounds the keywords ``groonga`` contained in the text " +"with ``<span class=\"keyword1\">`` and ``</span>``, and the keywords ``mysql`` " +"contained in the text with with ``<span class=\"keyword2\">`` and ``</span>``." +msgstr "" +"``--query \"groonga mysql\"`` は最初のレコードにマッチします。" +" ``highlight_full`` は、テキスト中に含まれるキーワード ``groonga`` を " +"``<span class=\"keyword1\">`` と ``</span>`` で囲み、 キーワード ``mysql`` " +"を ``<span class=\"keyword2\">`` と ``</span>`` で囲みます。" + +msgid "" +"Special characters such as ``<`` and ``>`` are escapsed as ``<`` and " +"``>``." +msgstr "" +"``<`` や ``>`` などの特殊文字は < や > にエスケープされています。" + +msgid "" +"``highlight_full`` returns a tagged string or ``null``. If " +"``highlight_full`` can't find any keywords, it returns ``null``." +msgstr "" +"``highlight_full`` はタグ付の文字列もしくは null を返します。" +"``highlight_full`` は該当するキーワードがない場合に null を返します。" + msgid "highlight_html" msgstr "" Added: doc/source/example/reference/functions/highlight_full/usage_basic.log (+26 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/functions/highlight_full/usage_basic.log 2014-08-11 04:32:42 +0900 (5b95f94) @@ -0,0 +1,26 @@ +Execution example:: + + select Entries --output_columns 'highlight_full(body, "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 + # [ + # [ + # 0, + # 1407695996.52987, + # 0.00151872634887695 + # ], + # [ + # [ + # [ + # 1 + # ], + # [ + # [ + # "highlight_full", + # "null" + # ] + # ], + # [ + # "Mroonga is a <span class=\"keyword2\">MySQL</span> storage engine based on <span class=\"keyword1\">Groonga</span>. <b>Rroonga</b> is a Ruby binding of <span class=\"keyword1\">Groonga</span>." + # ] + # ] + # ] + # ] Added: doc/source/example/reference/functions/highlight_full/usage_setup.log (+15 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/functions/highlight_full/usage_setup.log 2014-08-11 04:32:42 +0900 (c85ece9) @@ -0,0 +1,15 @@ +Execution example:: + + table_create Entries TABLE_NO_KEY + # [[0,1407692435.35498,0.0364797115325928],true] + column_create Entries body COLUMN_SCALAR ShortText + # [[0,1407692435.39156,0.0256640911102295],true] + table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto + # [[0,1407692435.423,0.0274741649627686],true] + column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body + # [[0,1407692435.45051,0.0534985065460205],true] + load --table Entries + [ + {"body": "Mroonga is a MySQL storage engine based on Groonga. <b>Rroonga</b> is a Ruby binding of Groonga."} + ] + # [[0,1407692435.50406,0.378907442092896],1] Added: doc/source/example/reference/functions/highlight_full/usage_string_literal.log (+26 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/functions/highlight_full/usage_string_literal.log 2014-08-11 04:32:42 +0900 (b5c1a71) @@ -0,0 +1,26 @@ +Execution example:: + + select Entries --output_columns 'highlight_full("Groonga is very fast fulltext search engine.", "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 --match_columns body --query "groonga" + # [ + # [ + # 0, + # 1407696157.1849, + # 0.00164437294006348 + # ], + # [ + # [ + # [ + # 1 + # ], + # [ + # [ + # "highlight_full", + # "null" + # ] + # ], + # [ + # "<span class=\"keyword1\">Groonga</span> is very fast fulltext search engine." + # ] + # ] + # ] + # ] Added: doc/source/reference/functions/highlight_full.rst (+93 -0) 100644 =================================================================== --- /dev/null +++ doc/source/reference/functions/highlight_full.rst 2014-08-11 04:32:42 +0900 (28ca08c) @@ -0,0 +1,93 @@ +.. -*- rst -*- + +.. highlightlang:: none + +.. groonga-command +.. database: functions_highlight_full + +highlight_full +============== + +.. caution:: + + This feature is experimental. API will be changed. + +Summary +------- + +``highlight_full`` tags target text. It can use to highlight the search +keyword. It can specify use/not use HTML escape, the normalizer name and +change the tag for each keyword. + +Syntax +------ + +``highlight_full`` has required parameter and optional parameter:: + + highlight_full(column, normalizer_name, use_html_escape, + keyword1, open_tag1, close_tag1, + ... + [keywordN, open_tagN, close_tagN]) + +Usage +----- + +Here are a schema definition and sample data to show usage. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_full/usage_setup.log +.. table_create Entries TABLE_NO_KEY +.. column_create Entries body COLUMN_SCALAR ShortText +.. table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +.. column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body +.. load --table Entries +.. [ +.. ["content"], +.. {"body": "Mroonga is a MySQL storage engine based on Groonga. <b>Rroonga</b> is a Ruby binding of Groonga."} +.. ] + +``highlight_full`` can be used in only ``--output_columns`` in +:doc:`/reference/commands/select`. + +``highlight_full`` requires Groonga 4.0.5 or later. + +``highlight_full`` requires :doc:`/reference/command/command_version` 2 +or later. + +The following example uses HTML escape and normalzier is ``NormalizeAuto``. +It specifies the tags ``<span class="keyword1">`` and ``</span>`` of the +keyword ``groonga``, and the tags ``<span class="keyword2">`` and ``</span>`` +of the keyword ``mysql``. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_full/usage_basic.log +.. select Entries --output_columns 'highlight_full(body, "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 + +The text are scanned by the keywords for tagging after they are normalized +by ``NormalizerAuto`` normalizer. + +``--query "groonga mysql"`` matches to the first record's body. +``highight_full`` surrounds the keywords ``groonga`` contained in the text +with ``<span class="keyword1">`` and ``</span>``, and the keywords ``mysql`` +contained in the text with with ``<span class="keyword2">`` and ``</span>``. + +Special characters such as ``<`` and ``>`` are escapsed as ``<`` and +``>``. + +You can specify string literal instead of column. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_full/usage_string_literal.log +.. select Entries --output_columns 'highlight_full("Groonga is very fast fulltext search engine.", "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 --match_columns body --query "groonga" + +Return value +------------ + +``highlight_full`` returns a tagged string or ``null``. If +``highlight_full`` can't find any keywords, it returns ``null``. + +See also +-------- + +* :doc:`/reference/commands/select` +* :doc:`/reference/functions/highlight_html` -------------- next part -------------- HTML����������������������������...Download