Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • A api
  • Project information
    • Project information
    • Activity
    • Members
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
Collapse sidebar
  • ironapi
  • api
  • Wiki
  • Api
  • Queries
  • Query Search Options

Query Search Options · Changes

Page history
attrs docu authored Jan 26, 2022 by Andrea Pavlovic's avatar Andrea Pavlovic
Hide whitespace changes
Inline Side-by-side
API/Queries/Query-Search-Options.md
View page @ 538043ff
...@@ -64,6 +64,25 @@ WHERE ( me.name = me.label ) ...@@ -64,6 +64,25 @@ WHERE ( me.name = me.label )
WHERE ( me.name like ? ) WHERE ( me.name like ? )
WHERE ( me.name not like ? ) WHERE ( me.name not like ? )
``` ```
## Regex
The regex operators (`~`, `!~`, `~*`, `!~*`) are supported:
`POST /data/system/entity/query`
```json
{
"conds" : {"me.name" : {"~*": "module.name"}}
}
```
```sql
WHERE ( me.name ~* ? )
```
If a column on a big table is not indexed correctly, this search option will not be allowed.
## (not) IN ## (not) IN
Search for a list of values. Search for a list of values.
...@@ -77,11 +96,12 @@ Search for a list of values. ...@@ -77,11 +96,12 @@ Search for a list of values.
# IronAPI Extensions # IronAPI Extensions
# -in_function ## -in_function
This is an extension for IronAPI. This is an extension for IronAPI.
Instead of defining an array of ids for the "in" statement, get an array of ids from a function. This will only work if the function used has explicitly been listed as permitted for this. Instead of defining an array of ids for the "in" statement, get an array of ids from a function.
This will only work if the function used has explicitly been listed as permitted for this.
```json ```json
{ {
...@@ -97,23 +117,7 @@ Instead of defining an array of ids for the "in" statement, get an array of ids ...@@ -97,23 +117,7 @@ Instead of defining an array of ids for the "in" statement, get an array of ids
"me.id" IN (SELECT * FROM core.assignment_ids_for_unit_instance(12)) "me.id" IN (SELECT * FROM core.assignment_ids_for_unit_instance(12))
``` ```
# Regex ## -similarity
The regex operators (`~`, `!~`, `~*`, `!~*`) are supported:
```json
#/data/system/entity/query
"conds" : {"me.name" : {"~*": "module.name"}}
```
```sql
WHERE ( me.name ~* ? )
```
If a column on a big table is not indexed correctly, this search option will not be allowed.
# Similarity
This is an extension for IronAPI. This is an extension for IronAPI.
...@@ -139,17 +143,19 @@ This will be translated to sql `ORDER BY me.name <-> ? : "constant"`. ...@@ -139,17 +143,19 @@ This will be translated to sql `ORDER BY me.name <-> ? : "constant"`.
If a column on a big table is not indexed correctly, this search option will not be allowed. If a column on a big table is not indexed correctly, this search option will not be allowed.
# tsquery ## -tsquery
This is an extension for IronAPI. This is an extension for IronAPI.
The attrs are just for reference, they are not needed for the search query! It uses Postgres' fulltext search with [tsvecor and tsquery](https://www.postgresql.org/docs/14/datatype-textsearch.html).
To search for "data" within the names of entites, which we know are written in "english":
`POST /data/system/entity/query`
```json ```json
#/data/system/entity/query
{ {
"conds" : {"-tsquery" : ["english","me.name","data"] }, "conds" : {"-tsquery" : ["english","me.name","data"] },
"attrs" : {"+select" : "to_tsquery('english',me.name)", "+as" : "tsquery_name"}
} }
``` ```
......
Clone repository
  • API
    • Available Endpoints
    • Changing Passwords
    • Form Input Types
    • Introduction
    • Logout
    • Plugins
    • Queries
    • Queries
      • Attributes
      • Context
      • Query Examples
      • Query Search Options
      • Referenced Instances
      • Saved Queries
    • Schema_Changes
    • Storing Files
View All Pages