Builds a criteria query for finding forum posts, comments and replies, combining criteria such as post ids, poster, website, forum, date range and free text with AND or OR semantics, plus nested sub-criteria. Built up fluently from server-side JS and executed with findMatching, which delegates to ForumManager.findMatchingPosts.


Methods

findMatching() · sort(String field, boolean ascending) · addPostId(Long id) · postIds(List<Long> postIds) · website(Website website) · poster(Profile poster) · startDate(Date startDate) · endDate(Date endDate) · deleted(Boolean deleted) · parent(Post parent) · forum(Forum forum) · name(String name) · title(String title) · and() · or() · newSubCriteria() · searchProperties(SearchProperties searchProperties) · hasCriteria()

findMatching()

Returns: List<Post>

Runs this request against the current organisation's posts and returns the matching results. Expensive: builds and executes a database query.

sort(String field, boolean ascending)

Returns: PostMatchRequest

Adds a sort field to the results and returns this request for chaining. Note that the ascending flag on this call is currently ignored; results are always sorted ascending on the given field.

ParameterDescription
fieldthe property name of Post to sort by
ascendingwhether to sort ascending (currently has no effect - sorting is always ascending)

addPostId(Long id)

Returns: PostMatchRequest

Adds a single post id to match on and returns this request for chaining. A post matches if its id is any one of the ids added this way.

ParameterDescription
idthe post id to add to the match list

postIds(List<Long> postIds)

Returns: PostMatchRequest

Sets the full list of post ids to match on, replacing any previously added ids, and returns this request for chaining.

ParameterDescription
postIdsthe post ids to match on

website(Website website)

Returns: PostMatchRequest

Restricts matches to posts made on the given website and returns this request for chaining.

ParameterDescription
websitethe website to match posts against

poster(Profile poster)

Returns: PostMatchRequest

Restricts matches to posts made by the given profile and returns this request for chaining.

ParameterDescription
posterthe profile who must have made the post

startDate(Date startDate)

Returns: PostMatchRequest

Restricts matches to posts made on or after the given date and returns this request for chaining.

ParameterDescription
startDatethe earliest post date to match, inclusive

endDate(Date endDate)

Returns: PostMatchRequest

Restricts matches to posts made before the given date and returns this request for chaining.

ParameterDescription
endDatethe post date to match up to, exclusive

deleted(Boolean deleted)

Returns: PostMatchRequest

Restricts matches to posts with the given deleted flag and returns this request for chaining.

ParameterDescription
deletedtrue to match only deleted posts, false to match only non-deleted posts

parent(Post parent)

Returns: PostMatchRequest

Restricts matches to posts whose parent post equals the given post and returns this request for chaining.

ParameterDescription
parentthe parent post to match replies of

forum(Forum forum)

Returns: PostMatchRequest

Restricts matches to forum posts in the given forum and returns this request for chaining. Only applies when combined with sub-criteria that themselves reference forum-post specific fields.

ParameterDescription
forumthe forum to match posts against

name(String name)

Returns: PostMatchRequest

Restricts matches to posts with the given name and returns this request for chaining. Ignored if name is blank.

ParameterDescription
namethe post name to match

title(String title)

Returns: PostMatchRequest

Restricts matches to posts with the given title and returns this request for chaining. Ignored if title is blank.

ParameterDescription
titlethe post title to match

and()

Returns: PostMatchRequest

Sets this request to combine its own criteria with AND, so a post must match every criterion added directly to this request. Returns this request for chaining.

or()

Returns: PostMatchRequest

Sets this request to combine its own criteria with OR, so a post matches if it satisfies any one criterion added directly to this request. Returns this request for chaining.

newSubCriteria()

Returns: PostMatchRequest

Creates a new nested PostMatchRequest, adds it to this request's list of sub-requests, and returns it so its own criteria can be set. Sub-requests are combined into the parent request's junction alongside its own criteria.

searchProperties(SearchProperties searchProperties)

Returns: PostMatchRequest

Sets paging and sorting properties to apply to the query and returns this request for chaining.

ParameterDescription
searchPropertiesthe paging and sorting properties for the search

hasCriteria()

Returns: boolean

Checks whether this request (ignoring the always-present deleted/date range checks handled by the caller) has at least one criterion set: a website, poster, date range, parent post, deleted flag, a non-empty list of post ids, or at least one sub-request.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.