Method: projects.locations.corpora.searchAssets

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

string

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 (DateTimeRangeArray)
  },
  "criteria": [
    {
      object (Criteria)
    }
  ],
  "exclusionCriteria": [
    {
      object (Criteria)
    }
  ],
  "facetSelections": [
    {
      object (FacetGroup)
    }
  ],
  "resultAnnotationKeys": [
    string
  ],
  "searchQuery": string,

  // Union field sort_spec can be only one of the following:
  "schemaKeySortingStrategy": {
    object (SchemaKeySortingStrategy)
  }
  // End of list of possible types for union field sort_spec.
}
Fields
pageSize

integer

The number of results to be returned in this page. If it's 0, the server will decide the appropriate pageSize.

pageToken

string

The continuation token to fetch the next page. If empty, it means it is fetching the first page.

contentTimeRanges

object (DateTimeRangeArray)

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[]

object (Criteria)

Criteria applied to search results.

exclusionCriteria[]

object (Criteria)

Criteria to exclude from search results. Note that fetchMatchedAnnotations will be ignored.

facetSelections[]

object (FacetGroup)

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[]

string

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

string

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

object (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 (SearchResultItem)
    }
  ],
  "nextPageToken": string,
  "facetResults": [
    {
      object (FacetGroup)
    }
  ]
}
Fields
searchResultItems[]

object (SearchResultItem)

Returned search results.

nextPageToken

string

The next-page continuation token.

facetResults[]

object (FacetGroup)

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 (Option)
    }
  ]
}
Fields
options[]

object (Option)

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 (AggregateMethod)
}
Fields
dataSchemaKey

string

The data used to sort.

sortDecreasing

boolean

Whether to sort in decreasing order or increasing order. By default, results are sorted in incresing order.

aggregateMethod

enum (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 (FacetBucket)
    }
  ],
  "bucketType": enum (FacetBucketType),
  "fetchMatchedAnnotations": boolean
}
Fields
facetId

string

Unique id of the facet group.

displayName

string

Display name of the facet. To be used by UI for facet rendering.

buckets[]

object (FacetBucket)

Buckets associated with the facet. E.g. for "Team" facet, the bucket can be 49ers, patriots, etc.

bucketType

enum (FacetBucketType)

Facet bucket type.

fetchMatchedAnnotations

boolean

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 bucket_value can be only one of the following:
  "value": {
    object (FacetValue)
  },
  "range": {
    object (Range)
  }
  // End of list of possible types for union field bucket_value.
}
Fields
selected

boolean

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

object (FacetValue)

Singular value.

range

object (Range)

Range value.

Range

The range of values [start, end) for which faceting is applied.

JSON representation
{
  "start": {
    object (FacetValue)
  },
  "end": {
    object (FacetValue)
  }
}
Fields
start

object (FacetValue)

Start of the range. Non-existence indicates some bound (e.g. -inf).

end

object (FacetValue)

End of the range. Non-existence indicates some bound (e.g. inf).