Clearspace API (1.7.0) Core Javadocs

com.jivesoftware.community
Interface SearchQueryCriteria


public interface SearchQueryCriteria

Criteria for searching. Use the factory methods jiveContext.getSearchQueryManager().createSearchQueryCriteria(xxx) to get a handle on a SearchQueryCriteria object. From there you can define criteria to use for filtering and sorting search query results that will be used by a SearchQuery.

See Also:
SearchQueryManager, SearchQuery

Nested Class Summary
static class SearchQueryCriteria.SortOrder
          Represents the order in which search results will be returned
static class SearchQueryCriteria.SortType
          Represents how search results will be sorted
 
Method Summary
 void filterOnUser(User user)
          Restricts the query results to content objects created by a specified user.
 java.util.Date getAfterDate()
          Returns the earliest date for search results.
 java.util.Date getBeforeDate()
          Returns the latest date for search results.
 BlogPostSearchQueryCriteria getBlogPostSearchQueryCriteria()
          Returns the BlogPostSearchQueryCriteria that can be used to specify criteria to sort and/or filter blog post search results.
 DocumentSearchQueryCriteria getDocumentSearchQueryCriteria()
          Returns the DocumentSearchQueryCriteria that can be used to specify criteria to sort and/or filter document search results.
 java.util.Collection<TagSet> getFilteredTagSets()
          Returns a collection of TagSets that query results are restricted to.
 User getFilteredUser()
          Returns the user that query results are restricted to.
 MessageSearchQueryCriteria getMessageSearchQueryCriteria()
          Returns the MessageSearchQueryCriteria that can be used to specify criteria to sort and/or filter message search results.
 java.lang.String getQueryString()
          Returns the search query string for the SearchQuery object.
 SearchQueryCriteria.SortOrder getSortOrder()
          Returns the sort order, which will be SearchQueryCriteria.SortOrder.ASCENDING for ascending sorting, or SearchQueryCriteria.SortOrder.DESCENDING for descending sorting.
 SearchQueryCriteria.SortType getSortType()
          Returns the sort type to use to sort search results.
 void setAfterDate(java.util.Date afterDate)
          Sets the earliest date for search results.
 void setBeforeDate(java.util.Date beforeDate)
          Sets the latest date for search results.
 void setFilterOnTagSets(java.util.Collection<TagSet> tagSets)
          Restricts the query results to content objects containing any one of the specified TagSets.
 void setSortOrder(SearchQueryCriteria.SortOrder sortOrder)
          Sets the sort type.
 void setSortType(SearchQueryCriteria.SortType sortType)
          Sets the sort type to use to sort search results.
 

Method Detail

getQueryString

java.lang.String getQueryString()
Returns the search query string for the SearchQuery object. If this object was created via one of SearchQueryManager.createSearchQueryCriteria(com.jivesoftware.community.BlogPost), SearchQueryManager.createSearchQueryCriteria(com.jivesoftware.community.Document) or SearchQueryManager.createSearchQueryCriteria(com.jivesoftware.community.ForumMessage) this will method will return null.

Returns:
the search query string.

getBlogPostSearchQueryCriteria

BlogPostSearchQueryCriteria getBlogPostSearchQueryCriteria()
Returns the BlogPostSearchQueryCriteria that can be used to specify criteria to sort and/or filter blog post search results.

Returns:
the BlogPostSearchQueryCriteria that can be used to specify criteria to sort and/or filter blog post search results.

getDocumentSearchQueryCriteria

DocumentSearchQueryCriteria getDocumentSearchQueryCriteria()
Returns the DocumentSearchQueryCriteria that can be used to specify criteria to sort and/or filter document search results.

Returns:
the DocumentSearchQueryCriteria that can be used to specify criteria to sort and/or filter document search results.

getMessageSearchQueryCriteria

MessageSearchQueryCriteria getMessageSearchQueryCriteria()
Returns the MessageSearchQueryCriteria that can be used to specify criteria to sort and/or filter message search results.

Returns:
the MessageSearchQueryCriteria that can be used to specify criteria to sort and/or filter message search results.

getBeforeDate

java.util.Date getBeforeDate()
Returns the latest date for search results. For example, the "before date" can be used to search for messages modified more than 1 month ago.

If the "before date" has not been set, this method will return null.

Returns:
the upper date boundary for search results based upon modification dates

setBeforeDate

void setBeforeDate(java.util.Date beforeDate)
Sets the latest date for search results. For example, the "before date" can be used to search for messages modified more than 1 month ago.

Parameters:
beforeDate - an upper date boundary for search results based upon modification dates

getAfterDate

java.util.Date getAfterDate()
Returns the earliest date for search results. For example, the "after date" can be used to search for messages modified within the last week.

If the "after date" has not been set, this method will return null.

Returns:
the lower date boundary for search results based upon modification dates

setAfterDate

void setAfterDate(java.util.Date afterDate)
Sets the earliest date for search results. For example, the "after date" can be used to search for messages modified within the last week.

Parameters:
afterDate - a lower date boundary for search results based upon modification dates

getFilteredUser

User getFilteredUser()
Returns the user that query results are restricted to. If the query is not restricted to content objects created by a certain user, this method will return null.

Returns:
the user that results are restricted to.

filterOnUser

void filterOnUser(User user)
Restricts the query results to content objects created by a specified user. Note: this method is not intended to show all content objects created by a user. Rather, it lets you filter out search results; for example, all messages matching the query "Jive rocks", but filtering out all results that aren't posted by some particular user. If you just want to see all messages posted by a user regardless of their actual content, use the ResultFilter class for a particular community, or the getUserMessages method for a user's messages among all communities.

Parameters:
user - a User to restrict query results to.
See Also:
ThreadResultFilter

getFilteredTagSets

java.util.Collection<TagSet> getFilteredTagSets()
Returns a collection of TagSets that query results are restricted to. If the query is not restricted to content objects having a specific TagSet, this method will return null.

Returns:
a collection of TagSets that the query results are restricted to, or null if there is no tagset restrictions

setFilterOnTagSets

void setFilterOnTagSets(java.util.Collection<TagSet> tagSets)
Restricts the query results to content objects containing any one of the specified TagSets. Note: this method is not intended to show all content objects with a particular tagset. Rather, it lets you filter out search results; for example, all blog posts matching the query "Jive rocks", but filtering out all results that don't have the specified TagSet.

Parameters:
tagSets - a collection of TagSets to restrict query results to.

getSortType

SearchQueryCriteria.SortType getSortType()
Returns the sort type to use to sort search results. Default is SearchQueryCriteria.SortType.RELEVANCE

Returns:
sort type to use to sort search results

setSortType

void setSortType(SearchQueryCriteria.SortType sortType)
Sets the sort type to use to sort search results. Default is SearchQueryCriteria.SortType.RELEVANCE. This method will also set the sort type for each specific search query criteria. If the sort type does not match a specific search query criteria, the default value for the specific search query criteria will be used.

Parameters:
sortType - the SortType that will be used for sorting.
See Also:
MessageSearchQueryCriteria, BlogPostSearchQueryCriteria, DocumentSearchQueryCriteria

getSortOrder

SearchQueryCriteria.SortOrder getSortOrder()
Returns the sort order, which will be SearchQueryCriteria.SortOrder.ASCENDING for ascending sorting, or SearchQueryCriteria.SortOrder.DESCENDING for descending sorting. Descending sorting is: 3, 2, 1, etc. Ascending sorting is 1, 2, 3, etc.

Returns:
the sort order.

setSortOrder

void setSortOrder(SearchQueryCriteria.SortOrder sortOrder)
Sets the sort type. Valid arguments are SearchQueryCriteria.SortOrder.ASCENDING for ascending sorting or SearchQueryCriteria.SortOrder.DESCENDING for descending sorting. Descending sorting is: 3, 2, 1, etc. Ascending sorting is 1, 2, 3, etc.

Parameters:
sortOrder - the order that results will be sorted in.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.