Skip to content

Commit

Permalink
query-v2: add more information
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jun 6, 2017
1 parent 4f6da8c commit 46f4cdf
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 16 deletions.
2 changes: 2 additions & 0 deletions reference/operators/match-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ upper_level: ../

# `&@` operator

Since 1.2.0.

## Summary

`&@` operator performs full text search by one keyword.
Expand Down
3 changes: 2 additions & 1 deletion reference/operators/match.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ upper_level: ../

## Summary

This operator is deprecated since 1.2.0. Use [`&@` operator](match-v2.html) instead.
This operator is deprecated since 1.2.0. Use [`&@` operator][match-v2] instead.

`%%` operator performs full text search by one keyword.

Expand Down Expand Up @@ -77,5 +77,6 @@ If you want to perform full text search with multiple keywords OR search, use [`

* [`&@|` operator][match-in-v2]

[match-v2]:match-v2.html
[query-v2]:query-v2.html
[match-in-v2]:match-in-v2.html
34 changes: 28 additions & 6 deletions reference/operators/query-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ upper_level: ../

# `&?` operator for non `jsonb` types

Since 1.2.0.

## Summary

`&?` operator performs full text search with query.
Expand All @@ -17,11 +19,27 @@ Query's syntax is similar to syntax that is used in Web search engine. For examp
column &? query
```

`column` is a column to be searched.
`column` is a column to be searched. It's `text` type, `text[]` type or `varchar` type.

`query` is a query for full text search. It's `text` type for `text` type or `text[]` type `column. It's `varchar` type for `varchar` type `column`.

[Groonga's query syntax][groonga-query-syntax] is used in `query`.

## Operator classes

You need to specify one of the following operator classes to use this operator:

* `pgroonga.text_full_text_search_ops`: Default for `text`.

`query` is a query for full text search. It's `text` type.
* `pgroonga.text_array_full_text_search_ops`: Default for `text[]`.

[Groonga's query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html) is used in `query`.
* `pgroonga.varchar_full_text_search_ops`: For `varchar`.

* `pgroonga.text_full_text_search_ops_v2`: For `text`.

* `pgroonga.text_array_full_text_search_ops_v2`: For `text[]`.

* `pgroonga.varchar_full_text_search_ops_v2`: For `varchar`.

## Usage

Expand Down Expand Up @@ -54,14 +72,18 @@ SELECT * FROM memos WHERE content &? 'PGroonga OR PostgreSQL';
-- (2 rows)
```

See [Groonga document](http://groonga.org/docs/reference/grn_expr/query_syntax.html) for query syntax details.
See [Groonga document][groonga-query-syntax] for query syntax details.

Note that you can't use syntax that starts with `COLUMN_NAME:` like `COLUMN_NAME:@KEYWORD`. It's disabled in PGroonga.

You can't use `COLUMN_NAME:^VALUE` for prefix search. You need to use `VALUE*` for prefix search.

## See also

* [`&@` operator](match-v2.html)
* [`&@` operator][match-v2]

* [Groonga's query syntax][groonga-query-syntax]

[match-v2]:match-v2.html

* [Groonga's query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html)
[groonga-query-syntax]:http://groonga.org/docs/reference/grn_expr/query_syntax.html
34 changes: 25 additions & 9 deletions reference/operators/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ upper_level: ../

## Summary

This operator is deprecated since 1.2.0. Use [`&?` operator](query-v2.html) instead.
This operator is deprecated since 1.2.0. Use [`&?` operator][query-v2] instead.

`@@` operator performs full text search with query.

Expand All @@ -19,11 +19,27 @@ Query's syntax is similar to syntax that is used in Web search engine. For examp
column @@ query
```

`column` is a column to be searched.
`column` is a column to be searched. It's `text` type, `text[]` type or `varchar` type.

`query` is a query for full text search. It's `text` type.
`query` is a query for full text search. It's `text` type for `text` type or `text[]` type `column. It's `varchar` type for `varchar` type `column`.

[Groonga's query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html) is used in `query`.
[Groonga's query syntax][groonga-query-syntax] is used in `query`.

## Operator classes

You need to specify one of the following operator classes to use this operator:

* `pgroonga.text_full_text_search_ops`: Default for `text`.

* `pgroonga.text_array_full_text_search_ops`: Default for `text[]`.

* `pgroonga.varchar_full_text_search_ops`: For `varchar`.

* `pgroonga.text_full_text_search_ops_v2`: For `text`.

* `pgroonga.text_array_full_text_search_ops_v2`: For `text[]`.

* `pgroonga.varchar_full_text_search_ops_v2`: For `varchar`.

## Usage

Expand Down Expand Up @@ -56,7 +72,7 @@ SELECT * FROM memos WHERE content @@ 'PGroonga OR PostgreSQL';
-- (2 rows)
```

See [Groonga document](http://groonga.org/docs/reference/grn_expr/query_syntax.html) for query syntax details.
See [Groonga document][groonga-query-syntax] for query syntax details.

Note that you can't use syntax that starts with `COLUMN_NAME:` like `COLUMN_NAME:@KEYWORD`. It's disabled in PGroonga.

Expand All @@ -68,10 +84,10 @@ TODO: Describe about `SET search_path = "$user",public,pgroonga,pg_catalog;`.

## See also

* [`&@` operator](match-v2.html)
* [`&@` operator][match-v2]

* [`%%` operator](match.html)
* [Groonga's query syntax][groonga-query-syntax]

* Deprecated since 1.2.0. Use [`&@` operator](match-v2.html) instead.
[match-v2]:match-v2.html

* [Groonga's query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html)
[groonga-query-syntax]:http://groonga.org/docs/reference/grn_expr/query_syntax.html

0 comments on commit 46f4cdf

Please sign in to comment.