Search
The Resources.Search
class provides methods to perform searches.
Methods
Make a search request
Description: This method performs a search across a specific index based on the provided parameters and returns the first page of results.
Function signature and example:
Parameters:
The SearchOptions
interface defines the parameters for performing a search request:
Return value: Returns a Promise
that resolves to a Models.SearchResult
object containing the search results.
API Reference: For a description of each field in the request and response, see the Any-to-video search page.
Related guides:
- Search.
- Pagination > Search results.
- Sorting > Search results
- Filtering > Search results
- Grouping and ungrouping.
Retrieve a specific page of search results
Description: This method retrieves a specific page of search results.
Note
This method provides direct pagination. Choose it mainly when the total number of items is manageable, or you must fetch a single page of results. When your application must retrieve a large number of items, choose iterative pagination. For details, see the Iterative pagination section.
Function signature and example:
Parameters:
Return value: Returns a Promise
that resolves to a Models.SearchResult
object containing the search results.
API Reference: For a description of each field in the request and response, see the Retrieve a specific page of search results page.
Related guides:
- Search.
- Pagination > Search results.
- Sorting > Search results
- Filtering > Search results
- Grouping and ungrouping.
Iterative pagination
If your application must retrieve a large number of items, use iterative pagination. To retrieve the first page of results, invoke the query
method of the search
object. To retrieve subsequent pages of results, use the async iterator protocol.
Error codes
This section lists the most common error messages you may encounter while using the Resources.Search
class.
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.