Query Syntax

Intro

Query syntax for the DeepSearch service is similar to that available in Google Search and Gmail, where the user can specify how to interpret part of the query by providing “prefixes”.

A query consists of a single line of text, for which the DeepSearch service returns top N results. The score for each asset is computed as a combination of name, tag matches and similarity to the input Query in the AI embedding space. Here are some search examples:

  • Query: white car

../../../_images/ngsearch_query_syntax_white_car.png
  • Query: watermelon

../../../_images/ngsearch_query_syntax_watermelon.png

Query filtering

As described in the previous section DeepSearch service takes into account tag and name matches, when scoring the indexed assets. You can augment the queries with additional filters to narrow down the search to a specific type of asset (e.g., ones created after a certain date or by a specific user, etc.). To achieve this, additional information in the query string must be in one of the following forms:

  • prefix:<oneword>

  • prefix:”<multiple words>”

Here, prefix is a single identifier without spaces, representing the filter type (e.g. “tag”, “name”, “created_by”, “modified_after”, etc. See Available Prefixes section for a complete list of supported prefixes).

Single query may contain multiple entries with prefixes in which case the effect of each individual filter (i.e. prefixed entry) will be combined. For example:

This will filter assets that have USD extension and are created by my-user@my-company.com user and then sort these results by positioning formula one cars first (text query).

The effect of prefixes can also be reversed, by adding a “-” in front of them, for example:

  • “formula 1 car” -name:”benetton”

This will sort the result by positioning the formula one cars first (text query), but remove those that have “benetton” in their name.

OR Syntax

As you learned in the previous section, you can use prefixes to filter query results. If you want to filter results based on any of the conditions for a given prefix (OR behavior), separate the conditions of that prefix with commas. For example, the following query selects the files with extension usd or jpg and sorts them by similarity with the concept of basket:

basket ext:usd,jpg

Note

Don’t use spaces around the comma. Otherwise, you’ll split the query.

When you search for substrings containing spaces or commas, the search expression needs to be enclosed in double quotes:

name:"name, with comma",test

This query matches assets that have either “name, with comma” or “test” (or both) in their name.

Warning

There is no way to OR filters with different prefixes, only conditions for the same prefix.

Wildcards

Some DeepSearch prefixes support wildcards.

Supported Wildcards

Wildcard

Description

Example

*

Matches any number of any characters

name:ca*t may find “cart” and “catapult” assets

?

Matches any single character

name:b?t may find “bat” and “bot” assets

Note

You can use multiple wildcards in a single, prefixed query. For example, name:c?a*r may find “chair” and “character” assets.

Supported Prefixes

Prefix

Example

name

name:sp*rt c?r

ext

ext:usd*

path

path:/p?th/to/my/aw?s*me/*lder

The default query also supports wildcards, but only to match asset names. For example, car matches assets based on a combination of their name, AI, and tag. car* matches assets that have car* in their name (equivalent to name:car*).

Available Prefixes

Prefix

Description

image

image-based similarity search

description

AI-driven text-based search

name

filters search results by the asset file name (partial matching is supported)

ext

filters search results by the asset file extension (e.g. ext:usd)

path

filters search results by the full path (e.g. path:/Path/to/my/Project)

tag

filters search results by a specific tag (e.g. tag:car)

created_after

filters search results that are newer than a specific date (e.g. created_after:2022-01-01)

created_before

filters search results that are older than a specific date (e.g. created_before:2022-01-01)

modified_after

filters search results that are modified after a specific date (e.g. modified_after:2022-01-01)

modified_before

filters search results that are modified before a specific date (e.g. modified_before:2022-01-01)

larger_than

filters search results that are larger than a given size (e.g. larger_than:"4MB")

smaller_than

filters search results that are smaller than a given size (e.g. smaller_than:"4KB")

created_by

filters search results that are created by a provided user (e.g. created_by:user-name@my-company.com)

modified_by

filters search results that aremodified by a provided user (e.g. modified_by:user-name@my-company.com)

max

limits the number of results returned from the search service (default: 32)