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
Update Query Search Options authored Dec 30, 2021 by Andrea Pavlovic's avatar Andrea Pavlovic
Show whitespace changes
Inline Side-by-side
API/Queries/Query-Search-Options.md
View page @ c3a65aa5
...@@ -61,17 +61,37 @@ WHERE ( me.name in (?) ) ...@@ -61,17 +61,37 @@ WHERE ( me.name in (?) )
WHERE ( me.name not in (?) ) WHERE ( me.name not in (?) )
``` ```
# -in_function
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.
```json
{
"conds": {
"me.id": {
"-in_function": "core.assignment_ids_for_unit_instance(12)"
}
}
}
```
```sql
"me.id" IN (SELECT * FROM core.assignment_ids_for_unit_instance(12))
```
# Regex # Regex
The regex operators (`~`, `!~`, `~*`, `!~*`) are supported: The regex operators (`~`, `!~`, `~*`, `!~*`) are supported:
```JSON ```json
#/data/system/entity/query #/data/system/entity/query
"conds" : {"me.name" : {"~*": "module.name"}} "conds" : {"me.name" : {"~*": "module.name"}}
``` ```
```SQL ```sql
WHERE ( me.name ~* ? ) WHERE ( me.name ~* ? )
``` ```
...@@ -82,7 +102,7 @@ If a column on a big table is not indexed correctly, this search option will not ...@@ -82,7 +102,7 @@ If a column on a big table is not indexed correctly, this search option will not
This is an extension for IronAPI. This is an extension for IronAPI.
```JSON ```json
{"attrs" : {"order_by" : {"-similarity" : ["me.name","constant"]}, "columns" : "me.name"}} {"attrs" : {"order_by" : {"-similarity" : ["me.name","constant"]}, "columns" : "me.name"}}
``` ```
...@@ -96,7 +116,7 @@ This is an extension for IronAPI. ...@@ -96,7 +116,7 @@ This is an extension for IronAPI.
The attrs are just for reference, they are not needed for the search query! The attrs are just for reference, they are not needed for the search query!
```JSON ```json
#/data/system/entity/query #/data/system/entity/query
{ {
"conds" : {"-tsquery" : ["english","me.name","data"] }, "conds" : {"-tsquery" : ["english","me.name","data"] },
...@@ -106,7 +126,7 @@ The attrs are just for reference, they are not needed for the search query! ...@@ -106,7 +126,7 @@ The attrs are just for reference, they are not needed for the search query!
will be translated to will be translated to
```SQL ```sql
WHERE ( to_tsvector(?,me.name) @@ to_tsquery(?, ? ) ): 'english', 'english', 'data' WHERE ( to_tsvector(?,me.name) @@ to_tsquery(?, ? ) ): 'english', 'english', 'data'
``` ```
...@@ -116,7 +136,7 @@ If a column on a big table is not indexed correctly, this search option will not ...@@ -116,7 +136,7 @@ If a column on a big table is not indexed correctly, this search option will not
This is an extension for IronAPI. Does the left JSONB value contain the right JSONB path/value entries at the top level? This is an extension for IronAPI. Does the left JSONB value contain the right JSONB path/value entries at the top level?
```JSON ```json
#/data/core/customer/query #/data/core/customer/query
{ {
"conds" : {"me.phonenumbers" : {"@>" : {"mobile": "+4354359"} } } "conds" : {"me.phonenumbers" : {"@>" : {"mobile": "+4354359"} } }
...@@ -129,7 +149,7 @@ This is an extension for IronAPI. ...@@ -129,7 +149,7 @@ This is an extension for IronAPI.
For entities which represent a tree structure ("isTree": true in the universe), a search for a subtree of an element possible. The following will return all entries of the current entity which are "under" id 1, i.e. have either "1" or any of it's (children's) children as their parent: For entities which represent a tree structure ("isTree": true in the universe), a search for a subtree of an element possible. The following will return all entries of the current entity which are "under" id 1, i.e. have either "1" or any of it's (children's) children as their parent:
```JSON ```json
{ {
"conds": {"me.id": {"-subtree": [1] } "conds": {"me.id": {"-subtree": [1] }
} }
...@@ -138,7 +158,7 @@ For entities which represent a tree structure ("isTree": true in the universe), ...@@ -138,7 +158,7 @@ For entities which represent a tree structure ("isTree": true in the universe),
The search may be limited to a certain depth, in this example it's "2", so only the main entry (with id "1") and it's direct children will be returned: The search may be limited to a certain depth, in this example it's "2", so only the main entry (with id "1") and it's direct children will be returned:
```JSON ```json
{ {
"conds": {"me.id": {"-subtree": [1, 2] } "conds": {"me.id": {"-subtree": [1, 2] }
} }
...@@ -146,7 +166,7 @@ The search may be limited to a certain depth, in this example it's "2", so only ...@@ -146,7 +166,7 @@ The search may be limited to a certain depth, in this example it's "2", so only
It can be combined with other search options, like this for example with "or": It can be combined with other search options, like this for example with "or":
```JSON ```json
{ {
"conds": [ "conds": [
{"me.id": {"-subtree": [1,2]}}, {"me.id": {"-subtree": [1,2]}},
...@@ -173,7 +193,7 @@ This is an extension for IronAPI. ...@@ -173,7 +193,7 @@ This is an extension for IronAPI.
Similar to -subtree, this allows to select the parent entries of an instance with the last entry being the last parent the user has access to. Similar to -subtree, this allows to select the parent entries of an instance with the last entry being the last parent the user has access to.
``` ```json
{ {
"me.id" : {"-parents" : 5} "me.id" : {"-parents" : 5}
} }
......
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