Suggestion (API Reference)
Class Suggestion
Suggestion is meant to provide relevant suggestions to partial queries, like "restaur", "starbu", "eiffel".
Represents a relevant response to user queries.
Suggestions (please check SuggestionType) are either:
Place: SuggestionType.PLACE
Query: SuggestionType.CHAIN or SuggestionType.CATEGORY
With "Place" you get data for a concrete place in the world. With "Query" something to follow-up, a way to perform more focused search.
-
Method Summary
Modifier and TypeMethodDescriptionThe text slices matching the input query.getHref()Gets the direct link for Discover query.getId()Gets the suggested item id.getPlace()Gets the suggested place item.getTitle()Gets the localized title for the suggestion.getType()Gets the type of suggestion.
-
Method Details
-
getHighlights
The text slices matching the input query.
- Returns:
Associated container where
HighlightTypeis a key and list ofIndexRangevalue.
-
getTitle
Gets the localized title for the suggestion.
- Returns:
The localized title for the suggestion.
-
getType
Gets the type of suggestion.
- Returns:
Type of the suggestion.
-
getPlace
Gets the suggested place item.
Available only for
SuggestionType.PLACE.- Returns:
The suggested place.
-
getId
Gets the suggested item id.
For online search, suggestion of type
SuggestionType.PLACEwill have Suggestion.id same as Place.id. For offline search, only suggestion of typeSuggestionType.CHAIN, will have this property filled with identifier number of an associated chain. For example, the chain ID "8778" corresponds to the chain name "ABC Shop". For other types,SuggestionType.PLACEandSuggestionType.CATEGORYthis property will be null.- Returns:
The unique id of suggested item. It can be used to query further information.
-
getHref
Gets the direct link for Discover query.
Available only for
SuggestionType.CHAINandSuggestionType.CATEGORY. This is not supported in offline search.- Returns:
Direct URL for precise query.
-