ResultFilter Type

Filters and sorts lists of threads and messages. This allows for a very rich set of possible queries that can be run on community data. Some examples are: "Show all messages posted in the community during the last year by a certain user" or "Show all threads in the community, sorted by their modification date". The class also supports pagination of results with the setStartIndex(int) and setNumResults(int) methods. If the start index is not set, it will begin at index 0 (the start of results). If the number of results is not set, it will be unbounded and return as many results as available. By default, result filters will obey the moderation rules as they are set for each community. You can override this behavior by setting a moderation range.

Type Template

<...>
    <creationDateRangeMax>xs:dateTime</creationDateRangeMax>
    <creationDateRangeMin>xs:dateTime</creationDateRangeMin>
    <moderationRangeMax>Integer</moderationRangeMax>
    <moderationRangeMin>Integer</moderationRangeMin>
    <modificationDateRangeMax>xs:dateTime</modificationDateRangeMax>
    <modificationDateRangeMin>xs:dateTime</modificationDateRangeMin>
    <numResults>Integer</numResults>
    <recursive>xs:boolean</recursive>
    <resolutionDateRangeMin>Integer</resolutionDateRangeMin>
    <!-- List of ... -->
    <resolutionStates>xs:string</resolutionStates>
    <resolutionnDateRangeMax>Integer</resolutionnDateRangeMax>
    <sortField>xs:int</sortField>
    <sortOrder>xs:int</sortOrder>
    <startIndex>xs:int</startIndex>
    <!-- List of ... -->
    <tags>xs:string</tags>
    <userID>Long</userID>
<...>

Note: Element descriptions are split into information that's relevant when you're creating an instance of this type and information relevant when you're receiving an instance of it. Occasionally these will differ.

Elements

Element Description
creationDateRangeMax
Setting
Sets a date that represents the upper boundry for messages or threads to be selected by the result filter. If this value is not set the results filter will be unbounded for the latest creation date selected.

Setting a date range for a ResultFilter is a potential performance bottleneck. For example, if the argument for the date range is "new Date()" then the corresponding database query will map to an accuracy of a particular millesecond in time. This means that the results can't be cached. A better solution is to round dates to the nearest minute, hour, etc (whatever accuracy you need).

Getting
Returns a date that represents the upper boundry for messages or threads to be selected by the result filter. If this value is not set it will return null and the results filter will be unbounded for the latest creation date selected.
creationDateRangeMin
Setting
Sets the date that represents the lower boundary for messages or threads to be selected by the result filter. If this value is not set the results filter will be unbounded for the earliest creation date selected.

Setting a date range for a ResultFilter is a potential performance bottleneck. For example, if the argument for the date range is "new Date()" then the corresponding database query will map to an accuracy of a particular millesecond in time. This means that the results can't be cached. A better solution is to round dates to the nearest minute, hour, etc (whatever accuracy you need).

Getting
Returns the creation date that represents the lower boundary for messages or threads to be filtered on. If this value has not been set, the method will return null.
moderationRangeMax
Setting
Sets the upper bound for the moderation value that will pass the result filter. If this value is not set, or is set to ResultFilter.NULL_INT there will be no upper bound on moderation values.
Getting
Returns the moderation value that represents the upper bound for messages or threads to be selected by the result filter. If an upper bound has not been set, this method will return ResultFilter.NULL_INT.
moderationRangeMin
Setting
Sets the moderation value that represents the lower bound for messages or threads to be selected by the result filter. If this value is not set, the lower bound will default to 1 (visible)
Getting
Returns the moderation value that represents the lower boundry for messages or threads to be selected by the result filter. If this value is not set it will return the lowest moderation value allowed and the results filter will be unbounded for the lowest moderation value selected.

For example -- if boolean moderation is being used, the possible values that can be expected of a message are -1 for rejected messages, 0 unapproved messages, and 1 for approved messages. To show messages available for the general public, you would pass this accessor a minimum value of 1 and a maximum value of 1 or higher. To show messages in need of moderation you would pass this accessor a minimum value of 0 and a maximum value of 0. To show messages in need of moderation in the context of threads that are already approved, you would pass this accessor a minumum value of 0 and a maximum value of 1.

modificationDateRangeMax
Setting
Sets a date that represents the upper boundry for messages or threads to be selected by the result filter. If this value is not set the results filter will be unbounded for the latest modified date selected.

Setting a date range for a ResultFilter is a potential performance bottleneck. For example, if the argument for the date range is "new Date()" then the corresponding database query will map to an accuracy of a particular millesecond in time. This means that the results can't be cached. A better solution is to round dates to the nearest minute, hour, etc (whatever accuracy you need).

Getting
Returns a date that represents the upper boundry for messages or threads to be selected by the result filter. If this value is not set it will return null and the results filter will be unbounded for the latest modified date selected.
modificationDateRangeMin
Setting
Sets a date that represents the lower boundary for messages or threads to be selected by the result filter. If this value is not set the results filter will be unbounded for the earliest modified date selected.

Setting a date range for a ResultFilter is a potential performance bottleneck. For example, if the argument for the date range is "new Date()" then the corresponding database query will map to an accuracy of a particular millesecond in time. This means that the results can't be cached. A better solution is to round dates to the nearest minute, hour, etc (whatever accuracy you need).

Getting
Returns a date that represents the lower boundary for messages or threads to be selected by the result filter. If this value is not set it will return null and the results filter will be unbounded for the earliest modified date selected.
numResults
Setting
Sets the limit on the number of results to be returned.
Getting
Returns the max number of results that should be returned. The default value for is NULL_INT, which means there will be no limit on the number of results. This method can be used in combination with setStartIndex(int) to perform pagination of results.
recursive
Setting
Sets the recursive value of queries. If set to true then database results will be done over an entire tree of communities, rather than in a specific community.

The default value of this is false which means only one community (and not its children) will be considered in results.

Getting
If true, the result filter will return content from all sub-communities of specified community, including content from sub-communities of sub-communities, etc. If false, only content from the specified community will be returned.

The default value of this is false which means that queries will be done in a non-recursive manner.

resolutionDateRangeMin
Setting
Getting
resolutionStates
Setting
Getting
resolutionnDateRangeMax
Setting
Getting
sortField
Setting
Sets the sort field to use. The default value is 9 (MODIFICATION_DATE) .

Valid sort fields for object types are as follows:

  • Communities -- 9 (MODIFICATION_DATE) , 8 (CREATION_DATE) , 16 (COMMUNITY_NAME)
  • Threads -- 9 (MODIFICATION_DATE) , 8 (CREATION_DATE) , 5 (THREAD_NAME)
  • Messages -- 9 (MODIFICATION_DATE) , 8 (CREATION_DATE) , 6 (MESSAGE_SUBJECT)
Getting
Returns the currently selected sort field. The default value is 9 (MODIFICATION_DATE) .

Valid sort fields for object types are as follows:

  • Threads -- 9 (MODIFICATION_DATE) , 8 (CREATION_DATE) , 5 (THREAD_NAME)
  • Messages -- 9 (MODIFICATION_DATE) , 8 (CREATION_DATE) , 6 (MESSAGE_SUBJECT)
sortOrder
Setting
Sets the sort type. Valid arguments are ResultFilter.ASCENDING for ascending sorting or ResultFilter.DESCENDING for descending sorting. Descending sorting is: 3, 2, 1, etc. Ascending sorting is 1, 2, 3, etc.
Getting
Returns the sort order, which will be ResultFilter.ASCENDING for ascending sorting, or ResultFilter.DESCENDING for descending sorting. Descending sorting is: 3, 2, 1, etc. Ascending sorting is 1, 2, 3, etc.
startIndex
Setting
Sets the index of the first result to return. For example, if the start index is set to 20, the Iterator returned will start at the 20th result in the query. This method can be used in combination with setNumResults(int) to perform pagination of results.
Getting
Returns the index of the first result to return.
tags
Setting
Sets the ContentTag s to filter on. Only results with at least one of the tags will be returned.
Getting
Returns the the ContentTag s to filter on.
userID
Setting
Sets the userID that results will be filtered on. If you'd like to filter on "anonymous" users, pass in an id of -1. By default, no filtering on userID's will take place. If you'd like to change so that no filtering is performed, pass in ResultFilter.NULL_INT.
Getting
Returns the userID that results will be filtered on. The method will return NULL_INT if no user to filter on has been specified. The method will return -1 if filtering is to take place on all "anonymous" users.