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:
Return value: Returns a models.SearchResult
object containing the search results.
API Reference: For a detailed 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. 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.
Function signature and example:
Parameters:
Return value: Returns 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 iterator protocol.
Error codes
This section lists the most common error messages you may encounter while using the search
.
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.