Class GLSearchRequest
startOnline(ResultsCallback) queries the online search service (/v1/search,
/v1/autocomplete); startOffline(ResultsCallback) queries the downloaded offline
maps. Both apply the same ranking and display rules. The low-level GLSearch class (tag
filters over offline data) is separate.
The request returns GLMapVectorObjectList with display data baked on each object: the
primary name through the object's localized name, the second line as the search:secondaryText
tag, and category/icon through GLSearch.GetSearchCategory(globus.glmap.GLMapVectorObject).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback invoked when an online or offline request finishes. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal String[]Optional GLSearch category identifiers, for example"cafe"or"restaurant".final globus.glmap.MapGeoPointSearch center used for result ranking.final intMaximum number of results.final String[]Ordered locale codes, for example{"be", "ru", "en", "native"}.final StringUser query text.final intRequest type: search or autocomplete.final globus.glmap.GLMapBBoxOptional visible bounds in internal map coordinates. -
Constructor Summary
ConstructorsConstructorDescriptionGLSearchRequest(int type, String text) Creates a search request from a type and text; center, limit, locales, and categories keep their defaults (no ranking center — global — and no category filter).GLSearchRequest(int type, String text, globus.glmap.MapGeoPoint center, int limit, String[] locales, String[] categories) Creates a search request with a ranking center.GLSearchRequest(int type, String text, globus.glmap.MapGeoPoint center, int limit, String[] locales, String[] categories, globus.glmap.GLMapBBox visibleArea) Creates a request with an optional soft viewport hint. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcancel(long requestID) Cancels a request started viastartOnline(ResultsCallback)orstartOffline(ResultsCallback).booleaninthashCode()longstartOffline(GLSearchRequest.ResultsCallback callback) Starts the same request against downloaded offline maps.longstartOnline(GLSearchRequest.ResultsCallback callback) Starts the request against the online search service.
-
Field Details
-
type
public final int typeRequest type: search or autocomplete. -
text
User query text. -
locales
Ordered locale codes, for example{"be", "ru", "en", "native"}. The first entry is the preferred display language; every entry is used for matching."native"requests the map object's native name. Null or empty uses native names only. -
limit
public final int limitMaximum number of results. Values less than 1 use server defaults. -
center
@Nullable public final globus.glmap.MapGeoPoint centerSearch center used for result ranking. The center is not a strict geographic filter. -
visibleArea
@Nullable public final globus.glmap.GLMapBBox visibleAreaOptional visible bounds in internal map coordinates. A soft hint, not a strict filter: centered online corrections use twice the farthest corner distance, clamped to 50–500 km. Named cities may move the search area. Null/empty clears the hint; without a center it has no effect. Offline builds without fuzzy support do not perform corrections. -
categories
Optional GLSearch category identifiers, for example"cafe"or"restaurant".
-
-
Constructor Details
-
GLSearchRequest
Creates a search request from a type and text; center, limit, locales, and categories keep their defaults (no ranking center — global — and no category filter). Use the full constructor to customize.- Parameters:
type- request type: search or autocompletetext- user query text or autocomplete input
-
GLSearchRequest
public GLSearchRequest(int type, @NonNull String text, @Nullable globus.glmap.MapGeoPoint center, int limit, @Nullable String[] locales, @Nullable String[] categories) Creates a search request with a ranking center. The two nullable refinements (locales, categories) come last.- Parameters:
type- request type: search or autocompletetext- user query text or autocomplete inputcenter- search center used for ranking nearby matches higher; null for a global requestlimit- maximum number of results; pass 0 to use server defaultslocales- ordered locale codes; the first is the display language, all are used for matching; null for native namescategories- GLSearch category identifiers; pass null for an unrestricted request
-
GLSearchRequest
public GLSearchRequest(int type, @NonNull String text, @Nullable globus.glmap.MapGeoPoint center, int limit, @Nullable String[] locales, @Nullable String[] categories, @Nullable globus.glmap.GLMapBBox visibleArea) Creates a request with an optional soft viewport hint. The hint is copied and is not a strict geographic filter.- Parameters:
type- request type: search or autocompletetext- user query text or autocomplete inputcenter- search center used for ranking nearby matches higher; null for a global requestlimit- maximum number of results; values less than 1 use the default limitlocales- ordered locale codes; the first is the display language, all are used for matching; null or empty for native namescategories- GLSearch category identifiers; null or empty for no category filtervisibleArea- visible bounds in internal map coordinates; null or empty for no viewport hint. The hint has no effect without a center and does not enable fuzzy matching in offline mobile builds.
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
startOnline
Starts the request against the online search service.The callback may be invoked on a background thread (or synchronously, when the request completes without starting). If you update UI, post back to the main thread. The callback is invoked exactly once per start: a request with nothing to search (both text and categories are empty, or an autocomplete prefix is below the minimum length) completes with an empty result. Category-only requests are valid. A cancelled request completes with an
ECANCELEDerror.- Parameters:
callback- callback that receives parsed vector objects or an error- Returns:
- request ID that can be passed to
cancel(long), or 0 if the request completed without starting
-
startOffline
Starts the same request against downloaded offline maps.Text, categories, center, limit and locales are mapped to the offline search engine with the same rules the online server uses, so both paths can share one code path in the app.
The callback may be invoked on a background thread (or synchronously, when the request completes without starting). If you update UI, post back to the main thread. The callback is invoked exactly once per start: a request with nothing to search (both text and categories are empty, or an autocomplete prefix is below the minimum length) completes with an empty result. Category-only requests are valid. A cancelled request completes with an
ECANCELEDerror.- Parameters:
callback- callback that receives result vector objects or an error- Returns:
- request ID that can be passed to
cancel(long), or 0 if the request completed without starting
-
cancel
public static void cancel(long requestID) Cancels a request started viastartOnline(ResultsCallback)orstartOffline(ResultsCallback). The callback of the cancelled request receives anECANCELEDerror.- Parameters:
requestID- request ID returned by the start method
-