# RSQL operators

## Background

The MOLGENIS REST query API makes use of RSQL. RSQL is a query language for parametrized filtering of entries in RESTful APIs. It’s based on FIQL (Feed Item Query Language), that was originally specified by Mark Nottingham as a language for querying Atom feeds. However the simplicity of RSQL and its capability to express complex queries in a compact and HTTP URI-friendly way makes it a good candidate for becoming a generic query language for searching REST endpoints.

## Supported RSQL operators

MOLGENIS supports the following operators:

| Operator      | Example                                                                            | Description                                                                                                                                                                  |
| ------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `==`          | `/api/v2/myTable?q=columnA==queryValue`                                            | Performs an **equals** query. Returns all rows from _myTable_ where values in _columnA_ exactly equal _queryValue_                                                           |
| `=q=`         | `/api/v2/myTable?q=columnA=q=queryValue`                                           | Performs a **search** query. Returns all rows from _myTable_ where values in _columnA_ contain _queryValue_                                                                  |
| `=like=`      | `/api/v2/myTable?q=columnA=like=queryValue`                                        | Performs a **like** query. Returns all rows from _myTable_ where values in _columnA_ are like _queryValue_                                                                   |
| `=in=`        | `/api/v2/myTable?q=columnA=in=(valueA, valueB)`                                    | Performs an **in** query. Returns all rows from _myTable_ where _columnA_ contains _valueA_ OR _valueB_                                                                      |
| `!=`          | `/api/v2/myTable?q=columnA!=queryValue`                                            | Performs a **not equals** query. Returns all rows from _myTable_ where values in _columnA_ do not equal _queryValue_                                                         |
| `=notlike=`   | `/api/v2/myTable?q=columnA=notlike=queryValue`                                     | Performs a **not like** query. Returns all rows from  _myTable_ where values in _columnA_ are not like _queryValue_                                                          |
| `<` & `=lt=`  | `/api/v2/myTable?q=columnA<queryValue`, `/api/v2/myTable?q=columnA=lt=queryValue`  | Performs a **lesser than** query. Returns all rows from _myTable_ where values in _columnA_ are lesser than _queryValue_                                                     |
| `=le=` & `<=` | `/api/v2/myTable?q=columnA<=queryValue`, `/api/v2/myTable?q=columnA=le=queryValue` | Performs a **lesser than or equal to** query. Returns all rows from _myTable_ where values in _columnA_ are lesser than or equal to _queryValue_                             |
| `<` & `=gt=`  | `/api/v2/myTable?q=columnA>queryValue`, `/api/v2/myTable?q=columnA=gt=queryValue`  | Performs a **greater than** query. Returns all rows from _myTable_ where values in _columnA_ are greater than _queryValue_                                                   |
| `>=` & `=ge=` | `/api/v2/myTable?q=columnA>=queryValue`, `/api/v2/myTable?q=columnA=ge=queryValue` | Performs a **equal to or greater than** query. Returns all rows from _myTable_ where values in _columnA_ are equal to or greater than _queryValue_                           |
| `=rng=`       | `/api/v2/myTable?q=columnA=rng=(fromValue,toValue)`                                | Performs a **from to** query. Returns all rows from _myTable_ where values in _columnA_ are equal or greater than the _fromValue_, and lesser than or equal to the _toValue_ |
| `=should=`    | N/A                                                                                | Not supported                                                                                                                                                                |
| `=dismax=`    | N/A                                                                                | Not supported                                                                                                                                                                |
| `=fuzzy=`     | N/A                                                                                | Not supported                                                                                                                                                                |
