Search
Details about the Search user journey
The onSearch
callback
onSearch
callbackWhenever the Assistant detects that the user is searching for items in the app, it will try to break down the search request into its basic components and invoke the onSearch
callback associated with the search user journey. The callback looks like this:
When this callback is invoked, the app is expected to:
Consume the details of the search request via the
SearchInfo
parameter.Fire the app's search request.
Finally, return the
AppState
along with the appropriateCondition
corresponding to the state that the app transitioned into
For example, for a given onSearch
callback invocation, if the search completes successfully and the app transitions to a screen showing search results, the app would return theAppState
as SEARCH_RESULTS along with condition SUCCESS , as shown below:
Sample Utterances that could trigger the search
The following are some examples of commands that could trigger this journey
"Onions"
"Show me onions"
"3 kgs of organic onions"
"Looking for fresho organic onions"
"Searching for Maggi Instant noodles in grocery"
"2 rs head and shoulders shampoo"
SearchInfo
Parameter
SearchInfo
ParameterThe parameterSearchInfo
contains the breakdown of the original search request. Its structure is as described below:
To illustrate, when the user says "Search for fresho organic onions", the following will be set in the Item object
brand = "Fresho Organic"
productNames = ["onion"]
isAddedToCart = false
completeDescription = "fresho organic onion"
Supported AppState
s
AppState
sThe following AppState
s are supported:
UNSUPPORTED (
UnsupportedAppState
): To be returned when the app is not ready to handle search yet. The Assistant will let the user know that the search is not yet supported by the app.
Supported Conditions
The following conditions are supported for each of the AppState
s supported by the Assistant
App State
App State Condition
SEARCH_RESULTS
(SearchResultsAppState
)
TERMINAL CONDITIONS
SUCCESS
The search was successful
ITEM_NOT_FOUND
The item being searched could not be
found
ITEM_OUT_OF_STOCK
The item being searched is out of stock
FAILURE
There was a failure while searching
NON-TERMINAL CONDITIONS
ITEM_NOT_SPECIFIED
The item that needs to be searched has
not been specified.
App State
App State Condition
ADD_TO_CART
(AddToCartAppState
)
TERMINAL CONDITIONS
SUCCESS
The search was successful
ITEM_NOT_FOUND
The item being searched could not be
found
ITEM_OUT_OF_STOCK
The item being searched is out of stock
FAILURE
There was a failure while searching
NON-TERMINAL CONDITIONS
ITEM_NOT_SPECIFIED
The item that needs to be searched has
not been specified.
ITEM_AMBIGUOUS
There are multiple items available for
the current searched item and has to be
disambiguated.
ITEM_AMBIGUOUS_FORCE_UI
Stop the voice disambiguation process
and choose the item via the UI/Touch
interface.
ITEM_QUANTITY_REQUIRED
Quantity for the current item has to be
specified.
For example, to indicate to the Assistant that the particular item being searched was not found by the app, the app should do the following:
Assistant Prompts
Based on the App State and the Condition that was set, the Assistant will speak out an appropriate message to the user. You can examine the default set of prompts configured for the Assistant through the Console and also customize it to your needs. Refer to the Customizing the Assistant section for details.
Last updated
Was this helpful?