- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- IAM Permissions
- SchemaKeySortingStrategy
- Option
- AggregateMethod
- FacetGroup
- FacetBucket
- Range
Search media asset.
HTTP request
POST https://visionai.googleapis.com/v1alpha1/{corpus=projects/*/locations/*/corpora/*}:searchAssets
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
corpus |
Required. The parent corpus to search. Format: `projects/{projectId}/locations/{locationId}/corpora/{corpus_id}' |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "pageSize": integer, "pageToken": string, "contentTimeRanges": { object ( |
Fields | |
---|---|
pageSize |
The number of results to be returned in this page. If it's 0, the server will decide the appropriate pageSize. |
pageToken |
The continuation token to fetch the next page. If empty, it means it is fetching the first page. |
contentTimeRanges |
Time ranges that matching video content must fall within. If no ranges are provided, there will be no time restriction. This field is treated just like the criteria below, but defined separately for convenience as it is used frequently. Note that if the endTime is in the future, it will be clamped to the time the request was received. |
criteria[] |
Criteria applied to search results. |
exclusionCriteria[] |
Criteria to exclude from search results. Note that |
facetSelections[] |
Stores most recent facet selection state. Only facet groups with user's selection will be presented here. Selection state is either selected or unselected. Only selected facet buckets will be used as search criteria. |
resultAnnotationKeys[] |
A list of annotation keys to specify the annotations to be retrieved and returned with each search result. Annotation granularity must be GRANULARITY_ASSET_LEVEL and its search strategy must not be NO_SEARCH. |
searchQuery |
Global search query. Allows user to search assets without needing to specify which field the value belongs to. |
Union field sort_spec . Sorting specification. If this field is not specified, by default: - STREAM_VIDEO: search results are sorted by the start time. sort_spec can be only one of the following: |
|
schemaKeySortingStrategy |
Sort by the value under the data schema key. |
Response body
Response message for corpora.searchAssets.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{ "searchResultItems": [ { object ( |
Fields | |
---|---|
searchResultItems[] |
Returned search results. |
nextPageToken |
The next-page continuation token. |
facetResults[] |
Facet search results of a given query, which contains user's already-selected facet values and updated facet search results. |
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
IAM Permissions
Requires the following IAM permission on the corpus
resource:
visionai.assets.search
For more information, see the IAM documentation.
SchemaKeySortingStrategy
A strategy to specify how to sort by data schema key.
JSON representation |
---|
{
"options": [
{
object ( |
Fields | |
---|---|
options[] |
Options in the front have high priority than those in the back. |
Option
Option for one data schema key.
JSON representation |
---|
{
"dataSchemaKey": string,
"sortDecreasing": boolean,
"aggregateMethod": enum ( |
Fields | |
---|---|
dataSchemaKey |
The data used to sort. |
sortDecreasing |
Whether to sort in decreasing order or increasing order. By default, results are sorted in incresing order. |
aggregateMethod |
Aggregate method for the current data schema key. |
AggregateMethod
When one result has multiple values with the same key, specify which value is used to sort. By default, AGGREGATE_METHOD_LARGEST is used when results are sorted in decreasing order, AGGREGATE_METHOD_SMALLEST is used when results are sorted in incresing order.
Enums | |
---|---|
AGGREGATE_METHOD_UNSPECIFIED |
The unspecified aggregate method will be overwritten as mentioned above. |
AGGREGATE_METHOD_LARGEST |
Take the (lexicographical or numerical) largest value to sort. |
AGGREGATE_METHOD_SMALLEST |
Take the (lexicographical or numerical) smallest value to sort. |
FacetGroup
A group of facet buckets to be passed back and forth between backend & frontend.
JSON representation |
---|
{ "facetId": string, "displayName": string, "buckets": [ { object ( |
Fields | |
---|---|
facetId |
Unique id of the facet group. |
displayName |
Display name of the facet. To be used by UI for facet rendering. |
buckets[] |
Buckets associated with the facet. E.g. for "Team" facet, the bucket can be 49ers, patriots, etc. |
bucketType |
Facet bucket type. |
fetchMatchedAnnotations |
If true, return query matched annotations for this facet group's selection. This option is only applicable for facets based on partition level annotations. It supports the following facet values: - INTEGER - STRING (DataSchema.SearchStrategy.EXACT_SEARCH only) |
FacetBucket
Holds the facet value, selections state, and metadata.
JSON representation |
---|
{ "selected": boolean, // Union field |
Fields | |
---|---|
selected |
Whether one facet bucket is selected. This field represents user's facet selection. It is set by frontend in SearchVideosRequest. |
Union field bucket_value . Bucket associated with a facet. For example, bucket of facet "team" can be "49ers", "patriots", etc; bucket of facet "player" can be "tom brady", "drew brees", etc. bucket_value can be only one of the following: |
|
value |
Singular value. |
range |
Range value. |
Range
The range of values [start, end) for which faceting is applied.
JSON representation |
---|
{ "start": { object ( |
Fields | |
---|---|
start |
Start of the range. Non-existence indicates some bound (e.g. -inf). |
end |
End of the range. Non-existence indicates some bound (e.g. inf). |