Search a knowledge store
The KnowledgeStoresClient class provides the search method to search across the items in a knowledge store using natural language.
Methods
Search a knowledge store
Description: This method searches a knowledge store using natural language and returns matching video clips and images ranked by relevance.
Use the query.text field to specify your natural-language query. Use the filter parameter to choose which items to search. Use the search_options parameter to choose how the platform matches videos.
By default, each result is an individual match: a video clip or an image. Set the group_by parameter to item to group clips under their parent item.
This method is rate-limited. For details, see the Rate limits page.
Function signature and example:
Parameters
The KnowledgeStoreSearchQuery class contains the following property:
The SearchKnowledgeStoreFilter class narrows results to specific items in the knowledge store. Omit the filter to search all items. An item must match all of the fields that you specify. The tags field also limits which clips of an item the search returns. When you use any of the user_metadata, enrichment, created_at, or location fields, the platform counts the items that match those conditions together. If more than 10,000 items match, the platform returns a 422 error with the metadata_filter_too_broad code. To reduce the count, add conditions or use the item_id field. The asset_type field does not reduce the count. When you use the tags field, the platform does not count items, and this limit does not apply. It counts the matching tags instead, as the TagFilter class describes. It contains the following properties:
The GeoCircleFilter class narrows results to items captured within a circle. An item matches when the GPS coordinates embedded in its source media are within radius_meters of the center, measured as great-circle distance. Items with no coordinates never match. To read the GPS coordinates of the source media, use the retrieve method of client.assets. The coordinates are the geospatial_latitude and geospatial_longitude fields of the technical_metadata object. It contains the following properties:
The TagFilter class narrows results to the moments and ranges that matching tags mark on video items. A tag matches when its tag_metadata field matches the metadata field. Only video items have tags, so images do not appear in the results. The search returns only the clips within a matching tag:
- For a tag on a range, a clip matches when it lies entirely within the range. A clip that extends past either end of the range does not appear in the results.
- For a tag on a single moment, a clip matches when it contains that moment.
A clip within more than one matching tag appears once. With the group_by parameter set to item, each item groups only its clips within matching tags. When you specify other fields of the filter, a tag counts only when its item matches every other field. The asset_type field does not reduce the count. If more than 100 tags match, the platform returns a 422 error with the metadata_filter_too_broad code. To tag a moment or a range of a video item, use the create method of client.knowledge_store_item_tags. It contains the following property:
The SearchKnowledgeStoreOptions class contains the following property:
The VideoSearchOptions class contains the following properties:
Return value
Returns a SearchKnowledgeStoreResponse object. The SearchKnowledgeStoreResponse class contains the following properties:
Each entry in the data array is a SearchKnowledgeStoreHit. The fields present depend on the asset_type field:
The VideoSearchItemMetadata class contains metadata attached to a video knowledge store item in search results. It contains the following properties:
The ImageSearchItemMetadata class contains metadata attached to an image knowledge store item in search results. It contains the following properties:
The VideoSearchSystemMetadata class contains system-generated metadata for a video item in search results. It contains the following properties:
The ImageSearchSystemMetadata class contains system-generated metadata for an image item in search results. It contains the following properties:
The VideoMatch class contains the following properties: