I'm implementing an integration with brand new HERE JavaScript places API (version 2.5.3) particularly using nokia.places.SearchBox().
I noticed that the old OVI SearchBox component, used in the same way, provided results with an higher detail level than the new HERE SearchBox component.
e.g. typing "oxford street london" I'm getting "Oxford Street, London, United Kingdom" using OVI and only "Oxford Street" with HERE.
Is it possible to obtain the same results with HERE API without implementing other solutions (e.g. REST API with custom behavior)? Maybe passing a parameter to the SearchBox() function...
Thanks in advance
This can be done by adding the showAddress
parameter.
Taking your example the following search box:
var fromSearchBox = new nokia.places.widgets.SearchBox({
targetNode: "fromSearchBox",
template: "fromSearchBox",
map: map
});
Returns the following responses to "Oxford Street" for a search centered on London
- Results
- Oxford Street
- Oxford Street
- John Lewis Oxford Street
Adding in the showAddress
parameter as shown:
var toSearchBox = new nokia.places.widgets.SearchBox({
targetNode: "toSearchBox",
template: "toSearchBox",
map: map,
suggestions : {showAddress: true}
});
And the "Oxford Street" query gives me:
- Results
- Oxford Street Southampton, SO14 3, United Kingdom
- Oxford Street Northwood, Cowes, PO31 8, United Kingdom
- Oxford Street Oxford Street, London,, United Kingdom
Further manipulation would be possible using the callbacks defined in the SearchBox constructor, specifically the handlers
called onSuggestions
and onSearchSuggestions
could be useful.