Bixby Developer Center

Guides

Location Autosuggest (viv.location)

The viv.location capsule provides an Autosuggest action that works with the auto-complete Views component, allowing Bixby to present real-time completion suggestions for contacts and nearby locations (named points).

Models

Autosuggest Action

InputTypeNotes
searchTermSearchTermRequired
isFuzzyMatchAddressTypebooleantrue: use fuzzy matching for Geo addresses
isSearchGeoLocationsbooleantrue: search geo locations

Concepts

There are matching primitive concepts for each of the Autosuggest inputs.

ConceptTypeDescription
SearchTermtextterm used to search for contacts or locations
IsFuzzyMatchAddressTypebooleantrue: use fuzzy matching for Geo addresses
IsSearchGeoLocationsbooleantrue: search geo locations

Usage

The viv.location library imports viv.contact and viv.geo.

Note

Accessing the user's contacts requires the user-profile-access permission. If this permission is not granted, Autosuggest can still autocomplete named locations.

Use Autosuggest in an auto-complete block as demonstrated in this example.

  • Use a SearchTerm as an input.
  • Set the autocompletion source to an intent whose goal is AutoSuggest. Using collect-with lets autocompletion happen as the user types.
input-view {
// DestinationPoint has role-of geo.NamedPoint
match: DestinationPoint

message ("Where would you like to go?")

render {
auto-complete {
type (geo.NamedPoint)
no-result-text { template ("No results") }
placeholder { template ("Search for locations") }
source {
collect-with (query) {
intent {
goal: location.Autosuggest
value: location.SearchTerm$expr (query)
value: location.IsFuzzyMatchAddressType(true)
}
}
label { template ("Search Results") }
where-each (place) {
display {
primary-text { template ("[#{value(place.name)}]") }
secondary-text { template ("[#{value(place.address)}]") }
}
on-select {
intent {
goal: DestinationPoint
value: viv.core.FormElement(place)
}
}
}
}
}
}
}

By default, Autosuggest will use location data to help resolve suggestions. You can disable this by setting isSearchGeoLocations to false in the intent block:

intent {
goal: location.Autosuggest
value: location.SearchTerm$expr (query)
value: location.IsSearchGeoLocations (false)
}

If you disable isSearchGeoLocations, then Autosuggest will not be able to autocomplete locations.

Setting isFuzzyMatchAddressType to true will allow "fuzzy matching" for address types such as home and office. By default, this is not enabled.