Kouhei Sutou
null+****@clear*****
Wed Oct 7 00:08:48 JST 2015
Kouhei Sutou 2015-10-07 00:08:48 +0900 (Wed, 07 Oct 2015) New Revision: 4722457d3a9779738c0266c7dc5be096029c2ce0 https://github.com/pgroonga/pgroonga.github.io/commit/4722457d3a9779738c0266c7dc5be096029c2ce0 Message: Translate match operator Modified files: reference/operators/like.md reference/operators/match.md reference/operators/query.md Modified: reference/operators/like.md (+3 -3) =================================================================== --- reference/operators/like.md 2015-10-06 23:58:12 +0900 (f603438) +++ reference/operators/like.md 2015-10-07 00:08:48 +0900 (f25a9b9) @@ -5,11 +5,11 @@ layout: en # `LIKE` operator -PGroonga converts `column LIKE '%KEYWORD%'` condition to `column @@ 'KEYWORD'` internally. [`@@` operator](match.html) does full text search with index. It's fast rather than `LIKE` operator without index. +PGroonga converts `column LIKE '%KEYWORD%'` condition to `column %% 'KEYWORD'` internally. [`%%` operator](match.html) does full text search with index. It's fast rather than `LIKE` operator without index. -Both beginning `%` and ending `%` are important. `'KEYWORD%'`, `'%KEYWORD'` and so on aren't converted to `column @@ 'KEYWORD'`. PGroonga returns no records for these patterns. Because PGroonga can't search these patterns with index. +Both beginning `%` and ending `%` are important. `'KEYWORD%'`, `'%KEYWORD'` and so on aren't converted to `column %% 'KEYWORD'`. PGroonga returns no records for these patterns. Because PGroonga can't search these patterns with index. -The original `LIKE` operator searches against text as is. But `@@` operator does full text search against normalized text. It means that search result of `LIKE` operator with index and search result of the original `LIKE` operator may be different. +The original `LIKE` operator searches against text as is. But `%%` operator does full text search against normalized text. It means that search result of `LIKE` operator with index and search result of the original `LIKE` operator may be different. For example, the original `LIKE` operator searches with case sensitive. But `LIKE` operator with index searches with case insensitive. Modified: reference/operators/match.md (+13 -3) =================================================================== --- reference/operators/match.md 2015-10-06 23:58:12 +0900 (d56ca3a) +++ reference/operators/match.md 2015-10-07 00:08:48 +0900 (adcb429) @@ -1,8 +1,18 @@ --- -title: "@@ operator" +title: "%% operator" layout: en --- -# `@@` operator +# `%%` operator -TODO +You can do full text search with one keyword by `%%` operator: + +```sql +SELECT * FROM memos WHERE content %% '全文検索'; +-- id | content +-- ----+--------------------------------------------------- +-- 2 | Groongaは日本語対応の高速な全文検索エンジンです。 +-- (1 行) +``` + +If you want to do full text search with multiple keywords or AND/OR search, use [`%%` operator](query.html). Modified: reference/operators/query.md (+17 -3) =================================================================== --- reference/operators/query.md 2015-10-06 23:58:12 +0900 (ae315d5) +++ reference/operators/query.md 2015-10-07 00:08:48 +0900 (460b24d) @@ -1,11 +1,25 @@ --- -title: "%% operator" +title: "@@ operator" layout: en --- -# `%%` operator +# `@@` operator -TODO +`キーワード1 OR キーワード2`のようにクエリー構文を使って全文検索をする +ときは`@@`演算子を使います。 + +```sql +SELECT * FROM memos WHERE content @@ 'PGroonga OR PostgreSQL'; +-- id | content +-- ----+--------------------------------------------------------------------------- +-- 3 | PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。 +-- 1 | PostgreSQLはリレーショナル・データベース管理システムです。 +-- (2 行) +``` + +クエリー構文の詳細は +[Groognaのドキュメント](http://groonga.org/ja/docs/reference/grn_expr/query_syntax.html) +を参照してください。 ただし、`カラム名:@キーワード`というように「`カラム名:`」から始まる構 文は無効にしてあります。そのため、前方一致検索をしたい場合は「`カラム -------------- next part -------------- HTML����������������������������...Download