# 7.13. grn_expr

Grn_expr is an object that searches records with specified conditions and manipulates a database. It’s pronounced as `gurun expression`.

Conditions for searching records from a database can be represented by conbining condition expressions such as `equal condition expression` and `less than condition expression` with set operations such as `AND`, `OR` and `NOT`. Grn_expr executes those conditions to search records. You can also use advanced searches such as similar search and near search by grn_expr. You can also use flexible full text search. For example, you can control hit scores for specified words and improve recall by re-searching with high-recall algolithm dinamically. To determine whether re-searching or not, the number of matched rescords is used.

There are three ways to create grn_expr:

> - Parsing Query syntax string.

> - Parsing Script syntax string.

> - Calling grn_expr related APIs.

Query syntax is for common search form in Internet search site. It’s simple and easy to use but it has a limitation. You can not use all condition expressions and set operations in Query syntax. You can use Query syntax with `query` option in select.

Script syntax is ECMAScript like syntax. You can use all condition expressions and set operations in Script syntax. You can use Script syntax with `filter` option and `scorer` option in select.

You can use groonga as a library and create a grn_expr by calling grn_expr related APIs. You can use full features with calling APIs like Script syntax. Calling APIs is useful creating a custom syntax to create grn_expr. They are used in rroonga that is Ruby bindings of Groonga. Rroonga can create a grn_expr by Ruby’s syntax instead of parsing string.

- 7.13.1. Query syntax
- 7.13.2. Script syntax

## 7.13.3. See also

> - grn_expr: grn_expr related APIs

previous

7.12. Cast

next

7.13.1. Query syntax