Class Suggestion

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 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 Details

    • getHighlights

      @NonNull public Map<HighlightType,List<IndexRange>> getHighlights()

      The text slices matching the input query.

      Returns:

      Associated container where HighlightType is a key and list of IndexRange value.

    • getTitle

      @NonNull public 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.

      Available only for SuggestionType.PLACE.

      Returns:

      The suggested place.

    • getId

      @Nullable public String getId()

      Gets the suggested item id.

      For online search, suggestion of type SuggestionType.PLACE will have Suggestion.id same as Place.id. For offline search, only suggestion of type SuggestionType.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 and SuggestionType.CATEGORY this property will be null.

      Returns:

      The unique id of suggested item. It can be used to query further information.

    • getHref

      @Nullable public String getHref()

      Gets the direct link for Discover query.

      Available only for SuggestionType.CHAIN and SuggestionType.CATEGORY. This is not supported in offline search.

      Returns:

      Direct URL for precise query.