Search P4 Server using a DSL query
You can run more complex searches with Domain Specific Language (DSL) queries. To create a DSL query, you must use the DSL keywords with the Boolean operators.
To run a basic search, see Search P4 Server using a basic search.
-
Select the Account button in the top navigation bar and select Search.
The Search page opens.
-
Choose a keyword. See DSL keywords.
The keyword dialog opens.
-
Choose a Boolean operator. See Boolean operators.
-
(Optional:) Check the Case Sensitive checkbox for case-sensitive results.
This option is only available for the User, Ext, Depot Path, and FileName keywords.
-
Choose a value from the dropdown list or enter a search string.
-
Select Apply.
Your search term is shown in the Search box at the top of the page.
-
Select Enter to run the search.
DSL keywords
Here is a list of all the DSL keywords that you can use to run a search. These keywords must be used with the Boolean operators.
| Keyword | Description | Query type | Case sensitive? | Examples |
|---|---|---|---|---|
|
text |
Specify any text or phrase you want to search for. |
multiMatch |
No |
text: "Hello World" text: tree sky |
|
model |
Specify the data model you want to search for. See Data models. |
term |
No |
model: content |
|
depotFile |
Specify the depot path using a wildcard character '*'. If you have special characters in your depot path, then you can use double quotes in the DSL query. |
wildcard |
Yes |
depotFile: //depot/main/* depotFile: "//depot/- 200/tests/*" |
|
fileName |
Specify the file name using a wildcard character '*'. |
wildcard |
Yes |
fileName: sky* |
|
detected |
Specify the detected AI (Artificial Intelligence) tags. |
list of match |
No |
detected: tree rock |
|
tag |
Specify the user-defined tags. |
list of match |
No |
tag: "red hat" hat |
|
ext |
Specify the file extension or the file name. |
list of wildcard |
Yes |
ext: jpeg png |
|
description |
Specify the changelist description within quotes. |
match_phrase_prefix |
No |
description: "fixed a bug" |
|
date |
Specify a date range or a date +/- a duration. You can also use the terms now, pastHour, pastDay, pastWeek, pastMonth, and pastYear. |
range |
Yes |
date: 2020/9/19 2023/2/22:23:59:59 date: pastDay date: now - 3hours date: pastWeek - 1day date: 1996/9/19 + 2weeks |
|
size |
Specify the file size. Accepts values in KB or KiB up to EiB. |
range |
Not applicable |
size: 3MB 8MB |
|
user |
Specify the username. |
term |
Yes |
user: axyz |
|
rev |
Specify the revision range or use 'latest'. |
range |
Not applicable |
rev: latest |
|
change |
Specify the changelist range or use 'latest'. |
range |
Not applicable |
|
|
content |
Specify the content of a file to match a query. |
match_phrase_prefix |
No |
content: "fixed bug" |
|
dimension |
Specify the 2D pixel dimension. |
range |
Not applicable |
dimension: width >= 1024 |
|
scene |
Specify the 3D scene geometry. |
range |
Not applicable |
scene: meshes > 30 |
Boolean operators
Here is a list of all the Boolean operators that you can use in a search. These must be used with the DSL keywords.
| Query | Description | Bool type | Example |
|---|---|---|---|
|
MUST + |
Specify the term that must exist in the search results. |
must |
MUST user: axyz Returns all the files in the results where the username matches 'axyz'. |
|
NOT - |
Specify the term that must not be included in the search results. |
must_not |
-depotFile: //depot/test/* Returns files from all depot paths except for '//depot/test/' |
|
<empty> |
Specify one term or another term that should be included in the search results. |
should |
detected: tree description: "Pine tree" Returns all the files that have AI tag 'tree' or have 'Pine tree' in the description. |
|
CASE = |
Specify case sensitivity for a DSL keyword that should be included in the search results. |
case |
=depotFile: //DEPOT/test/* Returns all files from the path '//DEPOT/test/*' |
Example DSL queries
Example 1
MUST model: asset tags: tree rock -depotFile: "//depot/- 200/tests/*" +user: axyz
This DSL query runs a search and gets results for all the files in P4 Search that match the following criteria:
-
the data model type is 'asset'
-
the search matches the AI tags 'tree' or 'rock'
-
excludes all files in the depot file path '//depot/tests/'
-
matches the username 'axyz' only
Example 2
+date: 2022/7/26 2022/8/1 +model: asset
This DSL query runs a search and gets results for all the assets that were submitted in the specified date range.
Example 3
ext: fbx obj MUST tags: white light MUST size: 3MB 100MB +model: asset
This DSL query runs a search and gets results for all the files in P4 Search that match the following criteria:
-
the file extension can be fbx or obj
-
the AI tags in a file must contain both the tags 'white' and 'light'
-
the file size must be between 3MB and 100MB
-
the data model type must be an 'asset'
Example 4
MUST ext: fbx obj MUST size: 3MB 100MB
This DSL query runs a search and gets results for all the files in P4 Search that match the following criteria:
-
the file extension can either be fbx or obj, but not both, so this does not return any results
-
the file size must be between 3MB and 100MB
Example 5
=+ext: JPG MUST size: 3MB 100MB +model: asset
This DSL query runs a search and gets results for all the files in P4 Search that match the following criteria:
-
the file extension must be JPG (case sensitive)
-
the file size must be between 3MB and 100MB
-
the data model type must be an 'asset'
To learn more about the DSL query API endpoints, see DSL query API endpoints.