Demo Notebook¶
API quick reference¶
This notebook focuses on building a personalized end-to-end OneBoxMap demo. Most-used elements:
UserProfile(...)OneBoxMap(...)OneBoxMap.show()OneBoxMap.run()UserProfile.get_current_language()
For the complete reference, see API Reference.
API methods used in this notebook¶
- class here_search_demo.user.UserProfile(use_positioning, share_experience, api=None, start_position=None, api_options=None, preferred_languages=None, name=None)
User preferences and runtime context for one-box interactions.
The profile stores consent flags, language preferences and the latest known user position. It can resolve locale information from coordinates through reverse geocoding and lookup calls.
- Variables:
name (str) – Human-readable profile name.
id (str) – Stable profile identifier derived from name and host node.
api (API) – API adapter used for locale lookup operations.
preferred_languages (dict) – Mapping of country code (or
None) to language.has_country_preferences (bool) – Whether country-specific preferences exist.
api_options (APIOptions) – Extra API options associated with this profile.
preferred_language (str) – Default language fallback for the profile.
current_latitude (float) – Latest latitude associated with the profile.
current_longitude (float) – Latest longitude associated with the profile.
current_position_country (str) – Latest resolved country code.
- get_current_language()
Return effective language for the current position context.
- get_preferred_country_language(country_code)
Return preferred language for a specific country.
Falls back to the default profile entry when no country match exists.
- Parameters:
country_code (
str) – ISO-like country code.- Returns:
Preferred language for the country, or
None.
- property share_experience
Whether the user has opted in to experience sharing.
- property use_positioning
Whether the user has opted in to position usage.
- class here_search_demo.widgets.app.OneBoxMap(credentials=None, user_profile=None, results_limit=None, suggestions_limit=None, terms_limit=None, place_taxonomy_buttons=None, extra_api_params=None, on_map=False, fuel=False, tripadvisor=False, recommendations=False, map_only=False, options=None, testing_header=False, **kwargs)
Interactive one-box search application with map and result panels.
OneBoxMapwires text input, taxonomy shortcuts, map rendering and result/details handling into a ready-to-use demo widget.- Parameters:
credentials (
Credentials|None) – Optional credentials provider.user_profile (
UserProfile|None) – Optional user profile controlling language/signals.results_limit (
int|None) – Max displayed results.suggestions_limit (
int|None) – Max displayed suggestions.terms_limit (
int|None) – Max displayed term buttons.place_taxonomy_buttons (
PlaceTaxonomyButtons|None) – Optional custom taxonomy buttons widget.extra_api_params (
dict|None) – Extra params forwarded to API requests.on_map (
bool) – Whether to display controls on map.fuel (
bool) – Enable fuel details.tripadvisor (
bool) – Enable TripAdvisor details.recommendations (
bool) – Enable recommendation reranking flow.map_only (
bool) – Hide JSON/log panels and keep map-centric layout.options (
APIOptions|None) – Optional prebuilt API options.testing_header (
bool) – Include NLP testing header for API calls.kwargs – Forwarded widget/layout options.
- run(handle_search_events=None)
Start the background consumer task and return
self.- Parameters:
handle_search_events (
Optional[Callable]) – Optional coroutine factory replacing the default event loop handler.- Returns:
Running app instance.
- Return type:
- show()
Display the application UI in the current notebook.
This displays the internal root widget without exposing or returning the underlying display handle.
- Return type:
None