Find portal items by using a keyword, and limit the results to items of a certain type - in this case, web maps.
Portals can contain many portal items and at times you may wish to query the portal to find what you're looking for. In this example, we search for webmap portal items using a text search.
Enter search terms into the search bar. Once the search is complete, a list is populated with the resultant webmaps. Tap on a webmap to set it to the map view. Scrolling to the bottom of the webmap recycler view will get more results.
- A
Portal
is created with no credential set, when the app starts, the portal is loaded. - A search bar allows the user to enter a keyword (a tag) to search for * e.g. "usa".
- The search term is passed as the
searchString
for aPortalQueryParametersForItems
which also has theitemType
set toEnums.PortalItemTypeWebMap
. NOTE if multiple item types are required these can be set via thetypes
property. Since webmaps authored prior to July 2nd, 2014 are not supported, a date filter is also applied. - The query parameters are passed to the portal's
findItems
method. - Once the
findItems
task is complete, aPortalQueryResultSetForItems
is obtained by callingfindItemsResult
on the portal. - The
PortalItemListModel
from the items result is set on aListView
to display the set of web maps. If many web maps match the search criteria, the results will contain only the 1st set (to allow "paging" through the results in batches). - If there are additional results, a subsequent query can be issued by clicking the "More Results" button. This passes the itemResult's
nextQueryParameters
object to a newfindItems
operation. - When the user double-clicks on a web map in the list, the
PortalItem
is loaded and set as aMap
on theMapView
- If the item is secured, the user may be prompted to login via the
AuthenticationView
- Portal
- PortalItem
- PortalItemListModel
- PortalQueryParametersForItems
- PortalQueryResultSetForItems
keyword, query, search, webmap