Start index and results limit are used when paging through large result sets. See
PortalQueryResultSet
.
A typical usage pattern is:
- Create a new PortalQueryParameters object.
- Optionally call one or more of the setter methods.
- Use the object by passing it to
Portal.findItemsAsync(PortalQueryParameters)
orPortal.findGroupsAsync(PortalQueryParameters)
. - Optionally call
PortalQueryResultSet.getNextQueryParameters()
to get a new PortalQueryParameters object that can be used to 'find' the next batch of results.
- Since:
- 100.0.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Signifies the sort order, indicating whether results are returned in ascending or descending order. -
Constructor Summary
ConstructorDescriptionCreates a PortalQueryParameters with default settings.PortalQueryParameters
(Envelope boundingBox) Creates a PortalQueryParameters with a particular bounding box.PortalQueryParameters
(String query) Creates a PortalQueryParameters with a particular query string.PortalQueryParameters
(String query, int limit) Creates a PortalQueryParameters with a particular query string and results limit.PortalQueryParameters
(String query, Envelope boundingBox) Creates a PortalQueryParameters with a particular query string and bounding box. -
Method Summary
Modifier and TypeMethodDescriptionGets the bounding box if one has been set.Gets a mutable List of content category specifications to use when searching for items usingPortal.findItemsAsync(PortalQueryParameters)
.int
getLimit()
Gets the results limit, which is used when paging through large result sets.getQuery()
Gets the query string to search with.Gets the field or fields to sort the results by.Gets the sort order, indicating whether the results are returned in ascending or descending order.int
Gets the start index, which is used when paging through large result sets.boolean
Returns whether or not public items outside the organization may be included in the query.setBoundingBox
(Envelope boundingBox) Sets the bounding box for a spatial search.void
setCanSearchPublic
(boolean canSearchPublic) Determines if public items outside the organization may be included in the query.setLimit
(int limit) Sets the results limit, which is used when paging through large result sets.setQuery
(PortalItem.Type type, String groupId, String searchQuery) Sets the query string to find items of a given type that are in a specific group with a specific search string.Sets the query string to find items of any one of a number of given types.Sets the query string to search with.setQueryForGroups
(String owner, String title) Sets the query string to find groups with a specified owner and title.setQueryForItemsInGroup
(String groupId) Sets the query string to find items in a specified group.setQueryForItemsWithOwner
(String owner, PortalItem.Type type, String searchQuery) Sets the query string to find items with a specified owner.setQueryForItemWithId
(String itemId) Sets the query string to find an item with a specified item ID.setSortField
(String sortField) Sets the field or fields to sort the results by.setSortOrder
(PortalQueryParameters.SortOrder sortOrder) Sets the sort order, indicating whether the results are returned in ascending or descending order.setStartIndex
(int startIndex) Sets the start index, which is used when paging through large result sets.withNextStart
(int nextStart) Returns a new copy of the PortalQueryParameters with the start index field being set to the nextStart parameter.
-
Constructor Details
-
PortalQueryParameters
public PortalQueryParameters()Creates a PortalQueryParameters with default settings. Start index will be 1, results limit will be 10, sort order will be ascending, and bounding box will be null. The query string will be null until one is set. If no query string is set, the PortalQueryParameters can be used to perform a generic search to find everything that is accessible to the current user.- Since:
- 100.0.0
-
PortalQueryParameters
Creates a PortalQueryParameters with a particular query string. This is the same asPortalQueryParameters()
, with the addition of the query string being set.- Parameters:
query
- the query string to use. The format is such as "owner:username AND title:mygroupname".- Since:
- 100.0.0
-
PortalQueryParameters
Creates a PortalQueryParameters with a particular bounding box. This is the same asPortalQueryParameters()
, with the addition of the bounding box being set.- Parameters:
boundingBox
- an Envelope specifying the bounding box- Throws:
IllegalArgumentException
- if boundingBox has no SpatialReference- Since:
- 100.2.0
- See Also:
-
PortalQueryParameters
Creates a PortalQueryParameters with a particular query string and bounding box. This is the same asPortalQueryParameters()
, with the addition of the query string and bounding box being set.- Parameters:
query
- the query string to use. The format is such as "owner:username AND title:mygroupname".boundingBox
- an Envelope specifying the bounding box- Throws:
IllegalArgumentException
- if boundingBox has no SpatialReference- Since:
- 100.2.0
- See Also:
-
PortalQueryParameters
Creates a PortalQueryParameters with a particular query string and results limit. This is the same asPortalQueryParameters()
, with the addition of the query string and results limit being set.- Parameters:
query
- the query string to use. The format is such as "owner:username AND title:mygroupname".limit
- maximum number of results to be included in the result set response. Used when paging through large result sets.- Since:
- 100.0.0
- See Also:
-
-
Method Details
-
withNextStart
Returns a new copy of the PortalQueryParameters with the start index field being set to the nextStart parameter. Start index is used when paging through large result sets.- Parameters:
nextStart
- the next start index- Returns:
- a copy of this PortalQueryParameters with the start index field being set to the nextStart parameter, or null if nextStart is negative
- Since:
- 100.0.0
- See Also:
-
setQueryForItemsInGroup
Sets the query string to find items in a specified group.- Parameters:
groupId
- ID of the group for which items are required- Returns:
- this PortalQueryParameters
- Throws:
IllegalArgumentException
- if groupId is null or empty- Since:
- 100.0.0
-
setQueryForItemsWithOwner
public PortalQueryParameters setQueryForItemsWithOwner(String owner, PortalItem.Type type, String searchQuery) Sets the query string to find items with a specified owner.- Parameters:
owner
- username of the owner of the items to search fortype
- item type to search for, or null to search for items of any typesearchQuery
- search string to use; null or empty for no search string- Returns:
- this PortalQueryParams
- Throws:
IllegalArgumentException
- if owner is null or empty- Since:
- 100.3.0
-
setQueryForGroups
Sets the query string to find groups with a specified owner and title.Either owner or title may be null, and the query string will only be set for the non-null parameter. If both are set, the query string will search for groups that are owned by the named user AND that match the specified title.
- Parameters:
owner
- username of the owner of the groups to search for; null or empty to search for groups with any ownertitle
- the title of the groups to search for; null or empty to search for groups with any title- Returns:
- this PortalQueryParameters
- Throws:
IllegalArgumentException
- if owner and title are both null or empty- Since:
- 100.0.0
-
setQuery
Sets the query string to find items of a given type that are in a specific group with a specific search string.Any of the parameters may be null, and the query string will only be set for the non-null parameters. If all are set, the query string will search for items that match the type AND are in the group AND match the search string. If none are set, the query string will do a generic search to find everything that is accessible to the current user.
- Parameters:
type
- item type to search for, or null to search for items of any typegroupId
- ID of the group to search for; null or empty to search for items in any groupsearchQuery
- search string to use; null or empty for no search string- Returns:
- this PortalQueryParameters
- Since:
- 100.0.0
-
setQuery
public PortalQueryParameters setQuery(Iterable<PortalItem.Type> types, String owner, String groupId, String searchQuery) Sets the query string to find items of any one of a number of given types. Optionally restricts the search to items belonging to a particular owner and/or group. An optional search string can be used to restrict the search even further.- Parameters:
types
- item types to search forowner
- username of the owner of the items; null or empty to search for items with any ownergroupId
- ID of the group to search for; null or empty to search for items in any groupsearchQuery
- search string to use; null or empty for no search string- Returns:
- this PortalQueryParams
- Throws:
IllegalArgumentException
- if types is null or empty- Since:
- 100.3.0
-
setQueryForItemWithId
Sets the query string to find an item with a specified item ID. This is a convenience method provided for the case where the user already has a portal and groups, knows the item ID, and is ready to use it.- Parameters:
itemId
- ID of the item- Returns:
- this PortalQueryParameters
- Throws:
IllegalArgumentException
- if itemId is null or empty- Since:
- 100.0.0
-
getQuery
Gets the query string to search with.- Returns:
- query string to search with
- Since:
- 100.0.0
-
setQuery
Sets the query string to search with.- Parameters:
query
- the query string for searching the portal, for example "owner:user AND title:username"- Returns:
- this PortalQueryParameters
- Since:
- 100.0.0
-
getBoundingBox
Gets the bounding box if one has been set.- Returns:
- the bounding box, or null if none has been set
- Since:
- 100.2.0
- See Also:
-
setBoundingBox
Sets the bounding box for a spatial search. The spatial search is an overlaps/intersects function of the query bounding box and the extent of the document. Documents that have no extent (for example mxds, 3dds, lyr) will not be found when doing a bounding box search.- Parameters:
boundingBox
- an Envelope specifying the bounding box; z- and m values, if any, are ignored; null is allowed and clears any bounding box that was previously set- Returns:
- this PortalQueryParameters
- Throws:
IllegalArgumentException
- if boundingBox has no SpatialReference- Since:
- 100.2.0
-
getCategories
Gets a mutable List of content category specifications to use when searching for items usingPortal.findItemsAsync(PortalQueryParameters)
.Each entry in the List is a String containing a comma-separated list of up to 8 organization-level content categories. The full path of each category is required and an OR relationship is applied between the categories within a particular String.
There can be up to 8 Strings with an AND relationship being applied between the different Strings.
For example, to search for items belonging to either the Water or Forest categories, both within the US, specify two Strings as follows: "/Categories/Water,/Categories/Forest" and "/Region/US".
The categories property is ignored if the PortalQueryParameters is used to search for groups using
Portal.findGroupsAsync(PortalQueryParameters)
.- Returns:
- a mutable List of content category specifications. Initially this List is empty and you can add content category specifications to it.
- Since:
- 100.8.0
-
getSortField
Gets the field or fields to sort the results by.- Returns:
- String containing a list of one or more fields names, comma separated, or null if none
- Since:
- 100.0.0
- See Also:
-
setSortField
Sets the field or fields to sort the results by. Allowed field names are title, uploaded, type, owner, avgRating, numRatings, numComments, and numViews.- Parameters:
sortField
- String containing a list of one or more fields names, comma separated- Returns:
- this PortalQueryParameters
- Since:
- 100.0.0
-
getSortOrder
Gets the sort order, indicating whether the results are returned in ascending or descending order.- Returns:
- the sort order for results
- Since:
- 100.0.0
-
setSortOrder
Sets the sort order, indicating whether the results are returned in ascending or descending order.- Parameters:
sortOrder
- sort order for results- Returns:
- this PortalQueryParameters
- Since:
- 100.0.0
-
getStartIndex
public int getStartIndex()Gets the start index, which is used when paging through large result sets. It is the index within the entire set of results of the first entry in the current page. The index number is 1-based.- Returns:
- start index to use when these PortalQueryParameters are submitted
- Since:
- 100.0.0
- See Also:
-
setStartIndex
Sets the start index, which is used when paging through large result sets. It is the index within the entire set of results of the first entry in the current page. The index number is 1-based.- Parameters:
startIndex
- start index to use when these PortalQueryParameters are submitted- Returns:
- this PortalQueryParameters
- Since:
- 100.0.0
- See Also:
-
getLimit
public int getLimit()Gets the results limit, which is used when paging through large result sets. It is the maximum number of results to be included in the result set response.- Returns:
- results limit to use when these PortalQueryParameters are submitted
- Since:
- 100.0.0
- See Also:
-
setLimit
Sets the results limit, which is used when paging through large result sets. It is the maximum number of results to be included in the result set response. It defaults to 10 if not set.- Parameters:
limit
- the results limit to use when these PortalQueryParameters are submitted- Returns:
- this PortalQueryParameters
- Since:
- 100.0.0
- See Also:
-
isCanSearchPublic
public boolean isCanSearchPublic()Returns whether or not public items outside the organization may be included in the query.- Returns:
- true if items outside the organization may be included
- Since:
- 100.0.0
-
setCanSearchPublic
public void setCanSearchPublic(boolean canSearchPublic) Determines if public items outside the organization may be included in the query. Default behavior is they are included.- Parameters:
canSearchPublic
- true to include items outside the organization- Since:
- 100.0.0
-