Navigation Menu

Skip to content

Commit

Permalink
Translate match operator
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 6, 2015
1 parent 39076ec commit 4722457
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
6 changes: 3 additions & 3 deletions reference/operators/like.md
Expand Up @@ -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.

Expand Down
16 changes: 13 additions & 3 deletions reference/operators/match.md
@@ -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).
20 changes: 17 additions & 3 deletions reference/operators/query.md
@@ -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)
を参照してください。

ただし、`カラム名:@キーワード`というように「`カラム名:`」から始まる構
文は無効にしてあります。そのため、前方一致検索をしたい場合は「`カラム
Expand Down

0 comments on commit 4722457

Please sign in to comment.