Interface Session

com.yandex.mapkit.search

public interface Session

Interface denoting ongoing search session.

Allows search cancellation and retry. For many request types allows further searches.

Nested Classes

Methods

void cancel()

Cancels the current request.

void fetchNextPage(@NonNull SearchListener searchListener)

Request the next page of search results.

boolean hasNextPage()

Check the availability of the next result page.

void resubmit(@NonNull SearchListener searchListener)

Redo the last search with currently set values of search area, search options, filters, sort type and sort origin.

void retry(@NonNull SearchListener searchListener)

Retries the last request.

void setFilters(@NonNull List< BusinessFilter > filters)

Set or clear filters for future resubmits; Full filter set is available in the first search response.

void setSearchArea(@NonNull Geometry area)

Sets the search area for future resubmits.

void setSearchOptions(@NonNull SearchOptions searchOptions)

Set searchOptions for future resubmits.

void setSortByDistance(@NonNull Geometry origin)

Requests sorting by distance for future resubmits.

void setSortByRank()

Requests sorting by rank for future resubmits.

Method Detail

cancel

public void cancel ()

Cancels the current request.

fetchNextPage

public void fetchNextPage (@NonNull SearchListener searchListener)

Request the next page of search results.

Ignored if the current request isn't ready. Will throw if called when Session#hasNextPage() is false.
Parameters:
searchListener

Listener to handle search result.

hasNextPage

public boolean hasNextPage ()

Check the availability of the next result page.

Returns:

True if there are more search results and one can call Session#fetchNextPage(SearchListener), false otherwise.

resubmit

public void resubmit (@NonNull SearchListener searchListener)

Redo the last search with currently set values of search area, search options, filters, sort type and sort origin.

Isn't applicable to reverse geosearch and URI resolving. Ignored it the current request is the first one; cancels current request otherwise.
Parameters:
searchListener

Listener to handle search result.

retry

public void retry (@NonNull SearchListener searchListener)

Retries the last request.

If there is an active request, it is cancelled.
Parameters:
searchListener

Listener to handle search result.

setFilters

public void setFilters (@NonNull List< BusinessFilter > filters)

Set or clear filters for future resubmits; Full filter set is available in the first search response.

Parameters:
filters

Filter set for future resubmits.

setSearchArea

public void setSearchArea (@NonNull Geometry area)

Sets the search area for future resubmits.

Supported geometry types: bounding box, polyline, polygon. Polygon is expected to be a search window: 4 points in outer ring (or 5 if last point is equal to first) and no inner rings.
Parameters:
area

Search area for future resubmits.

setSearchOptions

public void setSearchOptions (@NonNull SearchOptions searchOptions)

Set searchOptions for future resubmits.

Parameters:
searchOptions

Additional search parameters, see SearchOptions. Supported options: SearchOptions#origin, SearchOptions#userPosition.

setSortByDistance

public void setSortByDistance (@NonNull Geometry origin)

Requests sorting by distance for future resubmits.

Supported geometry types: point- polyline. Mutually exclusive with Session#setSortByRank().
Parameters:
origin

Origin to sort by distance from.

setSortByRank

public void setSortByRank ()

Requests sorting by rank for future resubmits.

Mutually exclusive with Session#setSortByDistance(Geometry).