Describe a time you worked on a project where you retrieved data from an API, displayed it on a screen, and added search functionality.
Implement search_api_results(pages, query, limit) for a paginated API response. Deduplicate items by first-seen id, match the query as a contiguous sequence of words in either title or description, rank title matches before description matches, preserve API order for ties, and return at most limit IDs. Matching is case-insensitive, and an empty query returns the first items in API order.
pages is a list of pages containing dictionaries with integer id and string title and description; return a list of integer IDs.
def search_api_results(pages, query, limit):