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 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. -
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, MapGeoPoint center, int limit, String[] locales, String[] categories) Creates a search request with a ranking center. -
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
Search center used for result ranking. The center is not a strict geographic filter. -
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 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
-
-
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
-