Jive API (3.0.13) 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
 
Method Summary
 Date getAfterDate()
          Returns the earliest date for search results.
 Date getBeforeDate()
          Returns the latest date for search results.
 boolean getCollapseThreadMessages()
           
 List<EntityDescriptor> getFilteredContainers()
          Returns the containers that query results are restricted to.
 Map<IndexField,String> getFilteredFields()
          Returns the fields that query results are restricted to.
 EntityDescriptor getFilteredObject()
          Returns the container that query results are restricted to.
 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.
 int getMaxSearchResults()
           
 String getQueryString()
          Returns the search query string for the SearchQuery object.
 IndexField getSearchedField()
          Returns the specific field which will be searched, if null all fields will be searched as is the default behavior.
 SearchQueryCriteria.SortOrder getSortOrder()
          Returns the sort order, which will be SearchQueryCriteria.SortOrder.ASCENDING for ascending sorting, or SearchQueryCriteria.SortOrder.DESCENDING for descending sorting.
 IndexField getSortType()
          Returns the sort type to use to sort search results.
 boolean isBlogUniquelyNamed()
          If a blog has a different name than its container, it is uniquely named.
 void setAfterDate(Date afterDate)
          Sets the earliest date for search results.
 void setBeforeDate(Date beforeDate)
          Sets the latest date for search results.
 void setBlogUniquelyNamed(boolean uniquelyNamed)
          If a blog has a different name than its container, it is uniquely named.
 void setCollapseThreadMessages(boolean collapseThread)
           
 void setFilterOnContainers(EntityDescriptor... containers)
          Restricts the query results to content objects created inside a specific containers.
 void setFilterOnField(IndexField field, String value)
          Restricts the query results by the given field and value.
 void setFilterOnObject(EntityDescriptor jiveObject)
          Restricts the query results to specific jiveobject.
 void setFilterOnTagSets(Collection<TagSet> tagSets)
          Restricts the query results to content objects containing any one of the specified TagSets.
 void setFilterOnUser(User user)
          Restricts the query results to content objects created by a specified user.
 void setMaxSearchResults(int maxSearchResults)
           
 void setSearchedField(IndexField field)
          Only a specific field will be searched when the searched field is specified.
 void setSortOrder(SearchQueryCriteria.SortOrder sortOrder)
          Sets the sort type.
 void setSortType(IndexField field)
          Sets the sort type to use to sort search results.
 

Method Detail

getQueryString

String getQueryString()
Returns the search query string for the SearchQuery object.

Returns:
the search query string.

getBeforeDate

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(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

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(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.

setFilterOnUser

void setFilterOnUser(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

getFilteredContainers

List<EntityDescriptor> getFilteredContainers()
Returns the containers that query results are restricted to. If the query is not restricted to content objects created by a certain container, this method will return null.

Returns:
the container that results are restricted to.

setFilterOnContainers

void setFilterOnContainers(EntityDescriptor... containers)
Restricts the query results to content objects created inside a specific containers.

Parameters:
containers - a contianers to restrict query results to.

getFilteredObject

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

Returns:
the container that results are restricted to.

setFilterOnObject

void setFilterOnObject(EntityDescriptor jiveObject)
Restricts the query results to specific jiveobject.

Parameters:
jiveObject - a jiveObject to restrict query results to.

setFilterOnField

void setFilterOnField(IndexField field,
                      String value)
Restricts the query results by the given field and value.

Parameters:
field - field to restrict the results by.
value - value of the field to restrict the results by.

getFilteredFields

Map<IndexField,String> getFilteredFields()
Returns the fields that query results are restricted to.

Returns:
the map of fields that results are restricted to.

getFilteredTagSets

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(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

IndexField getSortType()
Returns the sort type to use to sort search results. Default is IndexField#relevance

Returns:
sort type to use to sort search results

setSortType

void setSortType(IndexField field)
Sets the sort type to use to sort search results. Default is IndexField#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:
field - 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.

setSearchedField

void setSearchedField(IndexField field)
Only a specific field will be searched when the searched field is specified. If all fields should be searched this should be set to null as is the default behavior.

Parameters:
field - the only field which will be searched.
Since:
Jive SBS 3.0

getSearchedField

IndexField getSearchedField()
Returns the specific field which will be searched, if null all fields will be searched as is the default behavior.

Returns:
the specific field which will be searched

setBlogUniquelyNamed

void setBlogUniquelyNamed(boolean uniquelyNamed)
If a blog has a different name than its container, it is uniquely named. Setting this to true will cause any blogs that have an identical name as their parent to be filtered from the search results. The default value is false.


isBlogUniquelyNamed

boolean isBlogUniquelyNamed()
If a blog has a different name than its container, it is uniquely named. If this is set to true any blogs that have an identical name as their parent will be filtered from the search results.


setCollapseThreadMessages

void setCollapseThreadMessages(boolean collapseThread)

getCollapseThreadMessages

boolean getCollapseThreadMessages()

getMaxSearchResults

int getMaxSearchResults()

setMaxSearchResults

void setMaxSearchResults(int maxSearchResults)

Jive Product Page

Copyright © 1999-2007 Jive Software.