Search
The SearchWrapper class provides methods to perform search requests.
Methods
Make a search request
Description: This method performs a search across a specific index using text, media, or a combination of both as your query and returns a paginated iterator of search results.
Text queries:
- Use the
queryTextparameter to specify your query.
Media queries:
- Set the
queryMediaTypeparameter to the corresponding media type (example:image). - For a single image, specify one of the following parameters:
queryMediaUrl: Publicly accessible URL of your media file.queryMediaFile: Local media file. If you specify both,queryMediaUrltakes precedence.
- For multiple images, specify one of the following parameters (Marengo 3.0 only, up to 10 images):
queryMediaUrls: Publicly accessible URLs of your media files.queryMediaFiles: Local media files.
Composed text and media queries (Marengo 3.0 only):
- Use the
queryTextparameter for your text query. - Set
queryMediaTypetoimage. - Specify your images using
queryMediaUrl,queryMediaFile,queryMediaUrls, orqueryMediaFiles.
Note
When using images in your search queries (either as media queries or in composed searches), ensure your image files meet the requirements.
Entity search (Marengo 3.0 only):
- To find a specific person in your videos, enclose the unique identifier of the entity you want to find in the
queryTextparameter.
For instructions on setting up and using this feature, see the Entity search page.
Note
This method is rate-limited. For details, see the Rate limits page.
Function signature and example:
Parameters
The SearchCreateRequest interface defines the parameters for performing a search:
Return value
Returns a Promise that resolves to a Page<SearchItem> object that implements AsyncIterable, allowing you to iterate through the paginated search results.
The Page class contains the following properties and methods:
The SearchItem interface contains the following properties:
The SearchItemClipsItem interface contains the following properties:
API Reference
Related guides
Error codes
This section lists the most common error messages you may encounter while performing search requests.
search_option_not_supported- Search option
{search_option}is not supported for index{index_id}. Please use one of the following search options:{supported_search_option}.
- Search option
search_option_combination_not_supported- Search option
{search_option}is not supported with{other_combination}.
- Search option
search_filter_invalid- Filter used in search is invalid. Please use the valid filter syntax by following filtering documentation.
search_page_token_expired- The token that identifies the page to be retrieved is expired or invalid. You must make a new search request. Token:
{next_page_token}.
- The token that identifies the page to be retrieved is expired or invalid. You must make a new search request. Token:
index_not_supported_for_search:- You can only perform search requests on indexes with an engine from the Marengo family enabled.
For a list of errors specific to this endpoint and general errors that apply to all endpoints, see the Error codes page.