Class Suggestion
- Last UpdatedMay 13, 2025
- 2 minute read
- java.lang.Object
-
- com.here.NativeBase
-
- com.here.sdk.search.Suggestion
-
public final class Suggestion extends NativeBase
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
orSuggestionType.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<HighlightType,java.util.List<IndexRange>>
getHighlights()
The text slices matching the input query.java.lang.String
getHref()
Gets the direct link for Discover query.java.lang.String
getId()
Gets the suggested item id.Place
getPlace()
Gets the suggested place item.java.lang.String
getTitle()
Gets the localized title for the suggestion.SuggestionType
getType()
Gets the type of suggestion.
-
-
-
Method Detail
-
getHighlights
@NonNull public java.util.Map<HighlightType,java.util.List<IndexRange>> getHighlights()
The text slices matching the input query.
- Returns:
Associated container where
HighlightType
is a key and list ofIndexRange
value.
-
getTitle
@NonNull public java.lang.String getTitle()
Gets the localized title for the suggestion.
- Returns:
The localized title for the suggestion.
-
getType
@NonNull public SuggestionType getType()
Gets the type of suggestion.
- Returns:
Type of the suggestion.
-
getPlace
@Nullable public Place getPlace()
Gets the suggested place item.
- Returns:
The suggested place. Note: Available only for
SuggestionType.PLACE
.
-
getId
@Nullable public java.lang.String getId()
Gets the suggested item id.
- Returns:
The unique id of suggested item. It can be used to query further information. Note: For online search, suggestion of type
SuggestionType.PLACE
will have Suggestion.id same as Place.id. Note: 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.PLACE
andSuggestionType.CATEGORY
this property will be null.
-
getHref
@Nullable public java.lang.String getHref()
Gets the direct link for Discover query. Note: This is not supported in offline search.
- Returns:
Direct URL for precise query. Note: Available only for
SuggestionType.CHAIN
andSuggestionType.CATEGORY
.
-
-