Kouhei Sutou
null+****@clear*****
Sun Apr 24 22:17:05 JST 2016
Kouhei Sutou 2016-04-24 22:17:05 +0900 (Sun, 24 Apr 2016) New Revision: c42a34cfffcd3092355e46f49d7ac0bdba4a2db8 https://github.com/pgroonga/pgroonga.github.io/commit/c42a34cfffcd3092355e46f49d7ac0bdba4a2db8 Message: Document pgroonga.query_extract_keywords() Modified files: _po/ja/reference/functions/pgroonga-query-extract-keywords.po ja/reference/functions/pgroonga-query-extract-keywords.md reference/functions/pgroonga-query-extract-keywords.md Modified: _po/ja/reference/functions/pgroonga-query-extract-keywords.po (+124 -4) =================================================================== --- _po/ja/reference/functions/pgroonga-query-extract-keywords.po 2016-04-24 21:26:06 +0900 (63e4e00) +++ _po/ja/reference/functions/pgroonga-query-extract-keywords.po 2016-04-24 22:17:05 +0900 (68938aa) @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2016-04-19 15:20+0900\n" +"PO-Revision-Date: 2016-04-24 22:16+0900\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -14,15 +14,135 @@ msgid "" "layout: en\n" "---" msgstr "" +"---\n" +"title: pgroonga.query_extract_keywords関数\n" +"layout: ja\n" +"---" msgid "# `pgroonga.query_extract_keywords` function" -msgstr "" +msgstr "# `pgroonga.query_extract_keywords`関数" msgid "Since 1.0.7." -msgstr "" +msgstr "1.0.7で追加。" msgid "## Summary" msgstr "## 概要" -msgid "TODO" +msgid "" +"`pgroonga.query_extract_keywords` function extract keywords from text that use" +"s [query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html)" +". Query syntax is used by [`@@` operator](../operators/query.html), [`&?` oper" +"ator](../operators/query-v2.html) and so on." +msgstr "" +"`pgroonga.query_extract_keywords`関数は[クエリー構文](http://groonga.org/ja/docs/refere" +"nce/grn_expr/query_syntax.html)を使っているテキストからキーワードを抽出します。クエリー構文は[`@@`演算子](../ope" +"rators/query.html)や[`&?`演算子](../operators/query-v2.html)などで使われています。" + +msgid "" +"Extracting keywords from query helps you to use [`pgroonga.snippet_html` funct" +"ion](pgroonga-snippet-html.html), [`pgroonga.highlight_html` function](pgroong" +"a-highlight-html.html) and so on. They require keywords as an argument. Normal" +"ly, the keywords must be keywords in query." +msgstr "" +"クエリーからキーワードを抽出できると[`pgroonga.snippet_html`関数](pgroonga-snippet-html.html)や[`pg" +"roonga.highlight_html`関数](pgroonga-highlight-html.html)などを使いやすくなります。これらにはキーワード" +"を引数として渡さなければいけません。通常、渡すキーワードはクエリー内のキーワードになります。" + +msgid "## Syntax" +msgstr "## 構文" + +msgid "Here is the syntax of this function:" +msgstr "この関数の構文は次の通りです。" + +msgid "" +"```text\n" +"text[] pgroonga.query_extract_keywords(query)\n" +"```" +msgstr "" + +msgid "" +"`query` is a text that uses [query syntax](http://groonga.org/docs/reference/g" +"rn_expr/query_syntax.html)." +msgstr "" +"`query`は[クエリー構文](http://groonga.org/ja/docs/reference/grn_expr/query_syntax.ht" +"ml)を使っているテキストです。" + +msgid "`pgroonga.query_extract_keywords` returns an array of keywords." +msgstr "`pgroonga.query_extract_keywords`はキーワードの配列を返します。" + +msgid "" +"Search terms for AND condition and OR condition are keywords. Search terms for" +" NOT condition aren't keywords. For example, `A`, `B` and `C` are keywords and" +" `D` isn't keyword in `\"A (B OR C) - D\"`. `-` is NOT operator." +msgstr "" +"AND条件とOR条件の検索語はキーワードになります。NOT条件の検索語はキーワードになりません。たとえば、`\"A (B OR C) - D\"`では`A`と`" +"B`と`C`はキーワードで`D`はキーワードではありません。`-`はNOT演算子です。" + +msgid "## Usage" +msgstr "## 使い方" + +msgid "You can get all terms as keywords for AND only case:" +msgstr "ANDのみの場合はすべての語がキーワードになります。" + +msgid "" +"```sql\n" +"SELECT pgroonga.query_extract_keywords('Groonga PostgreSQL');\n" +" query_extract_keywords \n" +"------------------------\n" +" {PostgreSQL,Groonga}\n" +"(1 row)\n" +"```" msgstr "" + +msgid "You can get all terms as keywords for OR only case:" +msgstr "ORのみの場合はすべての語がキーワードになります。" + +msgid "" +"```sql\n" +"SELECT pgroonga.query_extract_keywords('Groonga OR PostgreSQL');\n" +" query_extract_keywords \n" +"------------------------\n" +" {PostgreSQL,Groonga}\n" +"(1 row)\n" +"```" +msgstr "" + +msgid "You can use parentheses:" +msgstr "カッコを使えます。" + +msgid "" +"```sql\n" +"SELECT pgroonga.query_extract_keywords('Groonga (MySQL OR PostgreSQL)');\n" +" query_extract_keywords \n" +"----------------------------\n" +" {Groonga,PostgreSQL,MySQL}\n" +"(1 row)\n" +"```" +msgstr "" + +msgid "Term for NOT condition isn't keyword:" +msgstr "NOT条件の語はキーワードになりません。" + +msgid "" +"```sql\n" +"SELECT pgroonga.query_extract_keywords('Groonga - MySQL PostgreSQL');\n" +" query_extract_keywords \n" +"------------------------\n" +" {PostgreSQL,Groonga}\n" +"(1 row)\n" +"```" +msgstr "" + +msgid "## See also" +msgstr "## 参考" + +msgid " * [`pgroonga.snippet_html` function](pgroonga-query-snippet-html.html)" +msgstr " * [`pgroonga.snippet_html`関数](pgroonga-query-snippet-html.html)" + +msgid " * [`pgroonga.highlight_html` function](pgroonga-query-highlight-html.html)" +msgstr " * [`pgroonga.highlight_html`関数](pgroonga-query-highlight-html.html)" + +msgid "" +" * [`pgroonga.match_positions_byte` function](pgroonga-match-positions-byte.h" +"tml)" +msgstr " * [`pgroonga.match_positions_byte`関数](pgroonga-match-positions-byte.html)" Modified: ja/reference/functions/pgroonga-query-extract-keywords.md (+71 -5) =================================================================== --- ja/reference/functions/pgroonga-query-extract-keywords.md 2016-04-24 21:26:06 +0900 (831bc43) +++ ja/reference/functions/pgroonga-query-extract-keywords.md 2016-04-24 22:17:05 +0900 (6985af3) @@ -1,12 +1,78 @@ --- -title: pgroonga.query_extract_keywords function -layout: en +title: pgroonga.query_extract_keywords関数 +layout: ja --- -# `pgroonga.query_extract_keywords` function +# `pgroonga.query_extract_keywords`関数 -Since 1.0.7. +1.0.7で追加。 ## 概要 -TODO +`pgroonga.query_extract_keywords`関数は[クエリー構文](http://groonga.org/ja/docs/reference/grn_expr/query_syntax.html)を使っているテキストからキーワードを抽出します。クエリー構文は[`@@`演算子](../operators/query.html)や[`&?`演算子](../operators/query-v2.html)などで使われています。 + +クエリーからキーワードを抽出できると[`pgroonga.snippet_html`関数](pgroonga-snippet-html.html)や[`pgroonga.highlight_html`関数](pgroonga-highlight-html.html)などを使いやすくなります。これらにはキーワードを引数として渡さなければいけません。通常、渡すキーワードはクエリー内のキーワードになります。 + +## 構文 + +この関数の構文は次の通りです。 + +```text +text[] pgroonga.query_extract_keywords(query) +``` + +`query`は[クエリー構文](http://groonga.org/ja/docs/reference/grn_expr/query_syntax.html)を使っているテキストです。 + +`pgroonga.query_extract_keywords`はキーワードの配列を返します。 + +AND条件とOR条件の検索語はキーワードになります。NOT条件の検索語はキーワードになりません。たとえば、`"A (B OR C) - D"`では`A`と`B`と`C`はキーワードで`D`はキーワードではありません。`-`はNOT演算子です。 + +## 使い方 + +ANDのみの場合はすべての語がキーワードになります。 + +```sql +SELECT pgroonga.query_extract_keywords('Groonga PostgreSQL'); + query_extract_keywords +------------------------ + {PostgreSQL,Groonga} +(1 row) +``` + +ORのみの場合はすべての語がキーワードになります。 + +```sql +SELECT pgroonga.query_extract_keywords('Groonga OR PostgreSQL'); + query_extract_keywords +------------------------ + {PostgreSQL,Groonga} +(1 row) +``` + +カッコを使えます。 + +```sql +SELECT pgroonga.query_extract_keywords('Groonga (MySQL OR PostgreSQL)'); + query_extract_keywords +---------------------------- + {Groonga,PostgreSQL,MySQL} +(1 row) +``` + +NOT条件の語はキーワードになりません。 + +```sql +SELECT pgroonga.query_extract_keywords('Groonga - MySQL PostgreSQL'); + query_extract_keywords +------------------------ + {PostgreSQL,Groonga} +(1 row) +``` + +## 参考 + + * [`pgroonga.snippet_html`関数](pgroonga-query-snippet-html.html) + + * [`pgroonga.highlight_html`関数](pgroonga-query-highlight-html.html) + + * [`pgroonga.match_positions_byte`関数](pgroonga-match-positions-byte.html) Modified: reference/functions/pgroonga-query-extract-keywords.md (+67 -1) =================================================================== --- reference/functions/pgroonga-query-extract-keywords.md 2016-04-24 21:26:06 +0900 (7280e62) +++ reference/functions/pgroonga-query-extract-keywords.md 2016-04-24 22:17:05 +0900 (f2db0c4) @@ -9,4 +9,70 @@ Since 1.0.7. ## Summary -TODO +`pgroonga.query_extract_keywords` function extract keywords from text that uses [query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html). Query syntax is used by [`@@` operator](../operators/query.html), [`&?` operator](../operators/query-v2.html) and so on. + +Extracting keywords from query helps you to use [`pgroonga.snippet_html` function](pgroonga-snippet-html.html), [`pgroonga.highlight_html` function](pgroonga-highlight-html.html) and so on. They require keywords as an argument. Normally, the keywords must be keywords in query. + +## Syntax + +Here is the syntax of this function: + +```text +text[] pgroonga.query_extract_keywords(query) +``` + +`query` is a text that uses [query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html). + +`pgroonga.query_extract_keywords` returns an array of keywords. + +Search terms for AND condition and OR condition are keywords. Search terms for NOT condition aren't keywords. For example, `A`, `B` and `C` are keywords and `D` isn't keyword in `"A (B OR C) - D"`. `-` is NOT operator. + +## Usage + +You can get all terms as keywords for AND only case: + +```sql +SELECT pgroonga.query_extract_keywords('Groonga PostgreSQL'); + query_extract_keywords +------------------------ + {PostgreSQL,Groonga} +(1 row) +``` + +You can get all terms as keywords for OR only case: + +```sql +SELECT pgroonga.query_extract_keywords('Groonga OR PostgreSQL'); + query_extract_keywords +------------------------ + {PostgreSQL,Groonga} +(1 row) +``` + +You can use parentheses: + +```sql +SELECT pgroonga.query_extract_keywords('Groonga (MySQL OR PostgreSQL)'); + query_extract_keywords +---------------------------- + {Groonga,PostgreSQL,MySQL} +(1 row) +``` + +Term for NOT condition isn't keyword: + +```sql +SELECT pgroonga.query_extract_keywords('Groonga - MySQL PostgreSQL'); + query_extract_keywords +------------------------ + {PostgreSQL,Groonga} +(1 row) +``` + +## See also + + * [`pgroonga.snippet_html` function](pgroonga-query-snippet-html.html) + + * [`pgroonga.highlight_html` function](pgroonga-query-highlight-html.html) + + * [`pgroonga.match_positions_byte` function](pgroonga-match-positions-byte.html) -------------- next part -------------- HTML����������������������������...다운로드