Advanced Search

Advanced Search allows users to search images in Vector Projects using more specific criteria than just image names.

To use Advanced Search for the first time in a project:

  1. In Data, click Advanced (β).
  2. Click Sync data.
  3. After your data is synced successfully, type a query in the query bar.

📘

If your permission to use Advanced Search was disabled then enabled, then you’ll have to sync the data again.

🚧

Advanced Search works in Vector Projects only.

Example queries

Try out Advanced Search with these queries. Replace some of the values in these queries to match your project and what you want to search. For example, let's say you want to search for images that have the tag cargo and have at least two instances with the class box.

This is the example query in the documentation: exists(select * from jsonb_array_elements_text(data -> 'tags') as tags where tags in ('vehicle') ) and data-> 'instancesMetadata'-> 'classes' ->> 'car' >= '1'

This is how you should write your query: exists(select * from jsonb_array_elements_text(data -> 'tags') as tags where tags in ('cargo') ) and data-> 'instancesMetadata'-> 'classes' ->> 'box' >= '2'

Check out the operators you can use and the valid values before writing a query below.

❗️

Don’t type OFFSET LIMIT in the query field.

Order data

Function

Query

To order your data by instance count (ascending)

order by data -> 'metadata' -> 'instanceCount'

To order your data by instance count (descending)

order by data -> 'metadata' -> 'instanceCount' desc

To order your data by status (ascending)

order by image_status

To order your images by status (descending)

order by image_status desc

📘

Order data by status

This is the order of the items by status:

  • Ascending: Not started, In progress, Quality check, Returned, Completed, and Skipped.
  • Descending: Skipped, Completed, Returned, Quality check, In progress, and Not started.

Tags

Function

Query

To search for images with the tags car and tree

exists(select from jsonb_array_elements_text(data->'tags') as tags where tags in ('car', 'tree' ))

Comments

Function

Query

To search for images with resolved comments

exists(select from jsonb_array_elements(data -> 'comments') as comments where comments ->> 'resolved' = 'true' HAVING COUNT(*)>0)

To search for images that contain more than 1 comment that was created by the Admin

exists(select from jsonb_array_elements(data -> 'comments') as comments where comments -> 'createdBy' ->> 'role' = 'Admin' having count(*)>1)

To search for images that contain this comment: Let's fix this.

exists(select from jsonb_array_elements(data -> 'comments') as comments, jsonb_array_elements(comments -> 'correspondence') as correspondence where correspondence->>'text' like '%Let’s fix this.%')

To search for images that have more than 0 comments

jsonb_array_length(data->'comments') > 0

Metadata

Function

Query

To search for images that have the name download(1).jpg

image_name='download(1).jpg'

To search for images that have a width higher than 1200

data->'metadata'->>'width'>'1200'

To search for images that have a height higher than 900

data->'metadata'->>'height'>'900'

To search for images that aren't pinned

data->'metadata'->>'pinned'='false'

To search for images that are assigned to the QA Morgan Smith

data->'metadata'->>'qaName'='Morgan Smith'

To search for images that are assigned to the QA whose email is [email protected]

data->'metadata'->>'qaEmail'='[email protected]'

To search for images that are assigned to the Annotator Taylor Weiss

data->'metadata'->>'annotatorName'='Taylor Weiss'

To search for images that are assigned to the Annotator whose email is [email protected]

data->'metadata'->>'annotatorEmail'='[email protected]'

To search for images that have the In progress status

image_status='inProgress'

To search for images where the last action was made by the user whose email is [email protected]

data->'metadata'->'lastAction'->>'email'='[email protected]'

To search for images whose approval status is No approval

data->'metadata'->>'approvalStatus'='noApproval'

To search for images that have the Completed status

data->'metadata'->>'status'='completed'

To search for images that have more than 4 tags

data->'metadata'->>'tagCount'>'4'

To search for images that have more than 2 comments

data->'metadata'->>'commentCount'>'2'

To search for images that have more than 7 instances

data->'metadata'->>'instanceCount'>'7'

To search for images that have more than 9 attributes

data->'metadata'->>'attributeCount'>'9'

Instances metadata

Function

Query

To search for images that have more than 3 polygons

data-> 'instancesMetadata'->'types'->> 'polygon' > '3'

To search for images that have more than 2 instances that were assigned the class car

data-> 'instancesMetadata'-> 'classes' ->> 'car' > '2'

To search for images that have more than 2 instances that were assigned the attribute red

data-> 'instancesMetadata'-> 'attributes' ->> 'red' > '2'

Instances

Function

Query

To search for images that have more than 3 bounding boxes

data-> 'instancesMetadata'->'types'->> 'bbox' > '3'

To search for images that have more than 2 locked instances

exists(select from jsonb_array_elements(data -> 'instances') as instances where instances -> 'locked' = 'true' having count(*) > 2)

To search for images that have more than 3 visible instances

exists(select from jsonb_array_elements(data -> 'instances') as instances where instances ->> 'visible' = 'true' having count(*)>3)

To search for images where more than 4 instances were created by an Annotator

exists(select from jsonb_array_elements(data -> 'instances') as instances where instances -> 'createdBy' ->> 'role' = 'Annotator' having count(*)>4)

To search for images where less than 5 instances were created by the contributor whose email is [email protected]

exists(select from jsonb_array_elements(data -> 'instances') as instances where instances -> 'createdBy' ->> 'email' = '[email protected]' having count(*)<5)

To search for images that contain more than 4 instances that were last updated by an Admin

exists(select from jsonb_array_elements(data -> 'instances') as instances where instances -> 'updatedBy' ->> 'role' = 'Admin' having count(*)>4)

To search for images that contain less than 5 instances that were last updated by the contributor whose email is a[email protected]

exists(select from jsonb_array_elements(data -> 'instances') as instances where instances -> 'updatedBy' ->> 'email' = '[email protected]' having count(*)<5)

Folder

Function

Query

To search for a folder with the name road

folderName = 'road'

To search for images in the root

folderName = 'root'

Combination queries

Function

Query

To search for images that have more than 3 bounding boxes that were created by the contributor whose email is [email protected]

exists (select from JSONB_ARRAY_ELEMENTS(data -> 'instances') as instances where instances ->> 'type' = 'bbox' and instances -> 'createdBy' ->> 'email' = '[email protected]' having count(*) > 3)

To search for images that have the tag vehicle and have at least two instances with the class car

exists(select * from jsonb_array_elements_text(data -> 'tags') as tags where tags in ('vehicle') ) and data-> 'instancesMetadata'-> 'classes' ->> 'car' >= '1'

Operators

Operator

Description

<

Less than

<=

Less than or equal to

Greater than

=

Greater than or equal to

<>

Not equal

=

Equal

||

Concatenate strings

!!=

NOT IN

~~

LIKE

!~~

NOT LIKE

~

Match (regex), case sensitive

~*

Match (regex), case insensitive

!~

Not match (regex), case sensitive

!~*

No match (regex), case insensitive

JSON

Each category below is divided into two parts:

  • JSON
  • A table that gives information for each JSON field: field description, data type, and valid values.

Example:

Field

Description

Data type

Valid values

metadata.name

Image name

String

The valid value is an image name. For example: "imageName.jpg"

Tags

"tags": [
    "tag1",
    "tag2",
    "tag3",
    "tag1"
  ]

Field

Description

Data type

Valid values

tags

Tag name

Array of strings

The valid value is a tag name. For example: car, tree.

Comments

"comments": [
    {
      "resolved": true,
      "createdBy": {
        "role": "Admin"
      },
      "correspondence": [
        {
          "text": "Let's fix this."
        }
       ]
   }
]

Field

Description

Data type

Valid values

comments[i].resolved

Information about whether the comment is resolved or not

Boolean

true, false

comments[i].createdBy.role

Role of the user who created the comment

String

“QA”, “Annotator”, “Admin”

comments[i].correspondence[j].text

Comment text

String

The valid value is a text. For example: Let’s fix this.

Metadata

"metadata": {
    "name": "download (1).jpg",
    "width": 1200,
    "height": 900,
    "pinned": false,
    "qaName": "Morgan Smith",
    "status": "inProgress",
    "qaEmail": "[email protected]",
    "lastAction": {
      "email": "[email protected]"
    },
    "annotatorName": "Taylor Weiss",
    "annotatorEmail": "[email protected]",
    "approvalStatus": "returned",
    "tagCount": 4,
    "commentCount": 2,
    "instanceCount": 7,
    "attributeCount": 9
  }

Field

Description

Data type

Valid values

metadata.name

Image name

String

The valid value is an image name. For example: download(1).jpg.

metadata.width

Image width

String

The valid value is a number. For example: 1200.

metadata.height

Image height

String

The valid value is a number. For example: 900.

metadata.pinned

Information whether the image is pinned or not

Boolean

true, false

metadata.qaName

Name of the assigned QA

String

The valid value is a name. For example: Morgan Smith.

metadata.qaEmail

Name of the assigned QA’s email

String

The valid value is an email. For example: [email protected]

metadata.annotatorName

Name of the assigned annotator

String

The valid value is a name. For example: Taylor Weiss.

metadata.annotatorEmail

Email of the assigned annotator

String

The valid value is an email. For example: [email protected]

metadata.status

Image annotation status

String

"notStarted", "inProgress", "qualityCheck", "returned", "completed",
"skipped"

metadata.lastAction.email

Email of the user who made the last action on the image

String

The valid value is an email. For example: [email protected]

metadata.approvalStatus

Image approval status

String

“disapproved”,
“approved”,
“noApproval”

metadata.tagCount

The number of tags on the image

String

The valid value is a number. For example: 4.

metadata.commentCount

The number of comments on the image

String

The valid value is a number. For example: 2.

metadata.instanceCount

The number of instances on the image

String

The valid value is a number. For example: 7.

metadata.attributeCount

The number of attributes on the image

String

The valid value is a number. For example: 9.

Instances metadata

"instancesMetadata": {
    "types": {
      "polygon": 20,
      "bbox": 7,
    },
    "classes": {
      "car": 1,
      "pedestrian": 1,
    },
    "attributes": {
      "red": 1,
      "in motion": 1,
    }
  }

Field

Description

Data type

Value

instancesMetadata.type

Instance type and how many times it was used on the image

Object (map)

Example: "polygon": 20,
“bbox”: 7

instancesMetadata.classes

Class name

String

The valid value is a class name. For example: car.

instancesMetadata.attributes

Attribute name

String

The valid value is an attribute name. For example: red.

Instances

“Instances”: [
{
      "type": "bbox",
      "locked": false,
      "visible": true,
      "createdBy": {
        "role": "Annotator",
        "email": "[email protected]"
      },
      "updatedBy": {
        "role": "Admin",
        "email": "[email protected]"
      }
}
]

Field

Description

Data type

Valid value

instances[i].type

Instance type

String

“polygon”, “cuboid”, “template”, “ellipse”, “event”, “rbbox”, “point”, “polyline”, “bbox”

instances[i].locked

Information about whether the instance is locked or not

Boolean

true, false

instances[i].visible

Information about whether the instance is visible or not

Boolean

true, false

instances[i].createdBy.role

Role of the user who created the instance

String

“QA”, “Admin”, “Annotator”

instances[i].createdBy.email

Email address of the user who created the instance

String

The valid value is an email. For example: [email protected]

instances[i].updatedBy.role

Role of the user who updated the instance

String

“QA”,
“Admin”,
“Annotator”

instances[i].updatedBy.email

Email of the user who updated the instance

String

The valid value is an email. For example: [email protected]

Notes

  1. All string, number, and boolean values must be queried with single quotes.

  2. These values are case-sensitive: image name, classes, attributes, and folder names.

  3. The attached images aren’t available in Advanced Search until you annotate the images. This also applies to video frames in Vector Projects and images uploaded with Python SDK.

  4. “order by” in queries has to be typed in lowercase letters.

  5. Begin the query from the “where” clause instead of “select” and “from”.

  6. instancesMetadata.classes and instancesMetadata.attributes don’t contain data about classes with no instances or non existent attributes. So if you’re searching for images that don’t have a specific class name or attribute name, the following queries won’t work:

    • data-> 'instancesMetadata'-> 'classes' ->> 'car' = '0'
    • data-> 'instancesMetadata'-> 'classes' ->> 'car' < '1'
    • data-> 'instancesMetadata'-> 'attributes' ->> 'red' = '0'
    • data-> 'instancesMetadata'-> 'attributes' ->> 'red' < '1'

You should type the query like this instead:

exists(select * from jsonb_object_keys(data -> 'instancesMetadata' -> 'classes') as classNames where classNames not in ('pedestrian', 'car' ))


Did this page help you?