I presume you looked at implementing code like this, from the documentation:
@AppIntent(schema: .system.search)
struct ExampleSearchIntent: ShowInAppSearchResultsIntent {
static var searchScopes: [StringSearchScope] = [.general]
var criteria: StringSearchCriteria
func perform() async throws -> some IntentResult {
let searchString = criteria.term
print("Searching for \(searchString)")
// ...
// Code that navigates to your app's search and enters the search string into a search field.
// ...
return .result()
}
}
The key type here, ShowInAppSearchResultsIntent, is a clear indication of the intended behavior of showing search results inside of the app. Also, testing your intent in the Shortcuts app is an excellent way to test.
Do I need to do AppIntents without the schema and wait until there is a search schema that does not open the app, or should I be using a different schema? What am I missing?
It's worth considering the larger picture of what someone does with your intent after the search — in many cases, there's a further set of actions the customer intends to take after they locate what they're looking for. In a shopping app, locating a product could be to add it to a shopping list, or to buy it now. For a travel app, searching for your flight might result in checking in for the reservation, paying for an upgrade, or rescheduling. When there are subsequent actions that can branch out in many directions after a search, having the search results presented inside the app helps facilitate the customer reaching that next action they intend to take.
That's not to say that the above is true in all cases, and you can certainly write your own custom intent that provides your own search functionality. Depending on your goal, if you had complex functionality in mind where you may want to offer predicate search options to the customer, you can do that without needing the schema based intents. There's an example of how to do that in a sample code project, take a look at TrailEntityQuery+PropertyQuery.swift in that project, and look for the Find intent inside of the Shortcuts app to find the matching functionality that the code in the referenced file unlocks.
— Ed Ford, DTS Engineer