Jive API (3.0.13) Core Javadocs

com.jivesoftware.community.user.profile
Class ProfileSearchQuery

java.lang.Object
  extended by com.jivesoftware.community.user.profile.ProfileSearchQuery

public class ProfileSearchQuery
extends Object

Contains the necessary information required to perform a user search.


Field Summary
static int MAXIMUM_NUMBER_OF_WILDCARDS
           
 
Constructor Summary
ProfileSearchQuery(String keywords)
          Creates a new query that does not contain any filters and searches all available user fields.
ProfileSearchQuery(String keywords, String prefix, List<ProfileSearchFilter> filters, String tag, boolean searchUsername, boolean searchName, boolean searchNamePhonetically, boolean searchEmail, boolean searchProfile, boolean admin)
          Creates a new query, results sorted by relevance.
ProfileSearchQuery(String keywords, String prefix, List<ProfileSearchFilter> filters, String tag, org.apache.lucene.search.Sort sort, boolean searchUsername, boolean searchName, boolean searchNamePhonetically, boolean searchEmail, boolean searchProfile, boolean admin, Community community, boolean returnDisabledUsers, boolean returnExternalUsers, boolean returnOnlineUsers)
          Creates a new query, results sorted by the given sort.
 
Method Summary
 Community getCommunity()
          Gets the community used for this query.
 List<ProfileSearchFilter> getFilters()
          Gets a list of ProfileSearchFilters used to filter user results for this query.
 String getInternalQuery()
          Get the internal query used by the search mechanism.
 String getKeywords()
          Gets the keywords for the user search.
 long getMaxCreationDate()
          Get the maximum document creation date for this query.
 long getMinCreationDate()
          Get the minimum document creation date for this query.
 String getPrefix()
          Get a single-character prefix used to filter names, such as "A" which would return all users with first names, last names, and usernames beginning in "A".
 int getRange()
          The number of returned user results.
 Collection<Long> getReturnedUserIDs()
          A collection of userids returned by a search using this query.
 org.apache.lucene.search.Sort getSort()
          Gets the sort used for this query.
 int getStart()
          The starting index of returned user results, with respect to total hits.
 String getTag()
          Get the tag for this query.
 boolean isAdmin()
          Return True if the user performing the search is a system administrator, false otherwise.
 boolean isEvilQuery()
          Check whether or not this query is dangerous.
 boolean isFiltered()
          Check whether or not this query has filters with non-null values.
 boolean isReturnCountOnly()
          If count only, don't populate userIDs or users in the returned ProfileSearchResults object.
 boolean isReturnDisabledUsers()
          Return True if the search returns disabled users.
 boolean isReturnExternalUsers()
          Return True if the search returns external (Cloud) users.
 boolean isReturnOnlineUsers()
          Return True if the search returns online users only.
 boolean isReturnProfiles()
          Return UserProfile objects in the ProfileSearchResults, instead of other, lighter-weight user implementations.
 boolean isReturnUserIDsOnly()
          If userIDs only, don't populate users in the returned ProfileSearchResults object.
 boolean isSearchEmail()
          Returns true if the user's email field is to be searched, false otherwise.
 boolean isSearchName()
          Returns true if the user's name field is to be searched, false otherwise.
 boolean isSearchNamePhonetically()
          Returns true if the user's name field is to be searched phonetically, false otherwise.
 boolean isSearchProfile()
          Returns true if the user's profile field values are to be searched, false otherwise.
 boolean isSearchUsername()
          Returns true if the user's username field is to be searched, false otherwise.
 void setAdmin(boolean admin)
          True if the user performing the search is a system administrator, false otherwise.
 void setCommunity(Community community)
          Sets the community the user wants to find an expert in.
 void setFilters(List<ProfileSearchFilter> filters)
          Sets a list of ProfileSearchFilters used to filter user results for this query.
 void setInternalQuery(String internalQuery)
           
 void setKeywords(String keywords)
          Sets the keywords for the user search.
 void setMaxCreationDate(long maxCreationDate)
          Set the maximum document creation date for this query.
 void setMinCreationDate(long minCreationDate)
          Set the minimum document creation date for this query.
 void setPrefix(String prefix)
          Set a single-character prefix used to filter names, such as "A" which would return all users with first names, last names, and usernames beginning in "A".
 void setRange(int range)
          The number of returned user results.
 void setReturnCountOnly(boolean returnCountOnly)
          If count only, don't populate userIDs or users in the returned ProfileSearchResults object.
 void setReturnDisabledUsers(boolean returnDisabledUsers)
           
 void setReturnedUserIDs(Collection<Long> returnedUserIDs)
          Provide a collection that will be used to populate the userIDs returned by a search.
 void setReturnExternalUsers(boolean returnExternalUsers)
           
 void setReturnOnlineUsers(boolean returnOnlineUsers)
           
 void setReturnProfiles(boolean returnProfiles)
          Return UserProfile objects in the ProfileSearchResults, instead of other, lighter-weight user implementations.
 void setReturnUserIDsOnly(boolean returnUserIDsOnly)
          If userIDs only, don't populate users in the returned ProfileSearchResults object.
 void setSearchEmail(boolean searchEmail)
          True if the user's email field is to be searched, false otherwise.
 void setSearchName(boolean searchName)
          True if the user's name field is to be searched, false otherwise.
 void setSearchNamePhonetically(boolean searchNamePhonetically)
          True if the user's name field is to be searched phonetically, false otherwise.
 void setSearchProfile(boolean searchProfile)
          True if the user's profile field values are to be searched, false otherwise.
 void setSearchUsername(boolean searchUsername)
          True if the user's username field is to be searched, false otherwise.
 void setSort(org.apache.lucene.search.Sort sort)
          Sets the Sort used for this query.
 void setStart(int start)
          The starting index of returned user results, with respect to total hits.
 void setTag(String tag)
          Sets the tag for this query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAXIMUM_NUMBER_OF_WILDCARDS

public static final int MAXIMUM_NUMBER_OF_WILDCARDS
See Also:
Constant Field Values
Constructor Detail

ProfileSearchQuery

public ProfileSearchQuery(String keywords)
Creates a new query that does not contain any filters and searches all available user fields.

Parameters:
keywords - the keywords to search

ProfileSearchQuery

public ProfileSearchQuery(String keywords,
                          String prefix,
                          List<ProfileSearchFilter> filters,
                          String tag,
                          boolean searchUsername,
                          boolean searchName,
                          boolean searchNamePhonetically,
                          boolean searchEmail,
                          boolean searchProfile,
                          boolean admin)
Creates a new query, results sorted by relevance.

Parameters:
keywords - the keywords to search
filters - a list of ProfileSearchFilters
searchUsername - true to search the user's username field, false otherwise.
searchName - true to search the user's name field, false otherwise. The user's name field will not be searchable if User.isNameVisible() is false.
searchEmail - true to search the user's email field, false otherwise. The user's email field will not be searchable if User.isEmailVisible() is false.
searchProfile - true to search the user's profile fields, false otherwise. A profile field will not be searchable if ProfileField.isVisible() is false.
admin - true to search the user's name and email fields, whether or not they are hidden. The default value for this field is false, and this field should only be set if the user performing the search is a system administrator.

ProfileSearchQuery

public ProfileSearchQuery(String keywords,
                          String prefix,
                          List<ProfileSearchFilter> filters,
                          String tag,
                          org.apache.lucene.search.Sort sort,
                          boolean searchUsername,
                          boolean searchName,
                          boolean searchNamePhonetically,
                          boolean searchEmail,
                          boolean searchProfile,
                          boolean admin,
                          Community community,
                          boolean returnDisabledUsers,
                          boolean returnExternalUsers,
                          boolean returnOnlineUsers)
Creates a new query, results sorted by the given sort.

Parameters:
keywords - the keywords to search
filters - a list of ProfileSearchFilters
sort - a field to sort the results by
searchUsername - true to search the user's username field, false otherwise.
searchName - true to search the user's name field, false otherwise. The user's name field will not be searchable if User.isNameVisible() is false.
searchEmail - true to search the user's email field, false otherwise. The user's email field will not be searchable if User.isEmailVisible() is false.
searchProfile - true to search the user's profile fields, false otherwise. A profile field will not be searchable if ProfileField.isVisible() is false.
admin - true to search the user's name and email fields, whether or not they are hidden. The default value for this field is false, and this field should only be set if the user performing the search is a system administrator.
community - a specific community that the user wants to find experts in
returnDisabledUsers -
Method Detail

getKeywords

public String getKeywords()
Gets the keywords for the user search.

Returns:
the keywords for the user search.

setKeywords

public void setKeywords(String keywords)
Sets the keywords for the user search.

Parameters:
keywords - the keywords for the user search

getPrefix

public String getPrefix()
Get a single-character prefix used to filter names, such as "A" which would return all users with first names, last names, and usernames beginning in "A".

Returns:
a single character String.

setPrefix

public void setPrefix(String prefix)
Set a single-character prefix used to filter names, such as "A" which would return all users with first names, last names, and usernames beginning in "A".

Parameters:
prefix - a single character String.

getFilters

public List<ProfileSearchFilter> getFilters()
Gets a list of ProfileSearchFilters used to filter user results for this query.

Returns:
a list of ProfileSearchFilters used to filter user results for this query.

setFilters

public void setFilters(List<ProfileSearchFilter> filters)
Sets a list of ProfileSearchFilters used to filter user results for this query.

Parameters:
filters - a list of ProfileSearchFilters used to filter user results for this query.

getSort

public org.apache.lucene.search.Sort getSort()
Gets the sort used for this query. Defaults to Sort.RELEVANCE.

Returns:
sorting strategy for this query.

setSort

public void setSort(org.apache.lucene.search.Sort sort)
Sets the Sort used for this query.

Parameters:
sort - sorting strategy for this query.

getMinCreationDate

public long getMinCreationDate()
Get the minimum document creation date for this query.

Returns:

setMinCreationDate

public void setMinCreationDate(long minCreationDate)
Set the minimum document creation date for this query.


getMaxCreationDate

public long getMaxCreationDate()
Get the maximum document creation date for this query.

Returns:

setMaxCreationDate

public void setMaxCreationDate(long maxCreationDate)
Set the maximum document creation date for this query.


getTag

public String getTag()
Get the tag for this query. User must have this tag to appear in results.

Returns:

setTag

public void setTag(String tag)
Sets the tag for this query. User must have this tag to appear in results.

Parameters:
tag -

getCommunity

public Community getCommunity()
Gets the community used for this query. Null unless the user wants to find an expert in a specific community.

Returns:
the community the user wants to find an expert in.

setCommunity

public void setCommunity(Community community)
Sets the community the user wants to find an expert in.

Parameters:
community - the community the user wants to find an expert in.

isSearchUsername

public boolean isSearchUsername()
Returns true if the user's username field is to be searched, false otherwise.

Returns:
true if the user's username field is to be searched, false otherwise.

setSearchUsername

public void setSearchUsername(boolean searchUsername)
True if the user's username field is to be searched, false otherwise.

Parameters:
searchUsername - true if the user's username field is to be searched, false otherwise.

isSearchName

public boolean isSearchName()
Returns true if the user's name field is to be searched, false otherwise. Note: The user's name field will not be searchable regardless of this value if User.isNameVisible() is false.

Returns:
true if the user's name field is to be searched, false otherwise.

setSearchName

public void setSearchName(boolean searchName)
True if the user's name field is to be searched, false otherwise. Note: The user's name field will not be searchable regardless of this value if User.isNameVisible() is false.

Parameters:
searchName - true if the user's name field is to be searched, false otherwise.

isSearchNamePhonetically

public boolean isSearchNamePhonetically()
Returns true if the user's name field is to be searched phonetically, false otherwise. Note: The user's name field will not be searchable regardless of this value if User.isNameVisible() is false.

Returns:
true if the user's name field is to be searched phonetically, false otherwise.

setSearchNamePhonetically

public void setSearchNamePhonetically(boolean searchNamePhonetically)
True if the user's name field is to be searched phonetically, false otherwise. Note: The user's name field will not be searchable regardless of this value if User.isNameVisible() is false.

Parameters:
searchNamePhonetically - true if the user's name field is to be searched phonetically, false otherwise.

isSearchEmail

public boolean isSearchEmail()
Returns true if the user's email field is to be searched, false otherwise. Note: The user's email field will not be searchable regardless of this value if User.isEmailVisible() is false.

Returns:
true if the user's email field is to be searched, false otherwise.

setSearchEmail

public void setSearchEmail(boolean searchEmail)
True if the user's email field is to be searched, false otherwise. Note: The user's email field will not be searchable regardless of this value if User.isEmailVisible() is false.

Parameters:
searchEmail - true if the user's email field is to be searched, false otherwise.

isSearchProfile

public boolean isSearchProfile()
Returns true if the user's profile field values are to be searched, false otherwise. Note: The user's profile field values will not be searchable regardless of this value if ProfileField.isVisible() is false.

Returns:
true if the user's profile field values are to be searched, false otherwise.

setSearchProfile

public void setSearchProfile(boolean searchProfile)
True if the user's profile field values are to be searched, false otherwise. Note: The user's profile field values will not be searchable regardless of this value if ProfileField.isVisible() is false.

Parameters:
searchProfile - true if the user's profile field values are to be searched, false otherwise.

isAdmin

public boolean isAdmin()
Return True if the user performing the search is a system administrator, false otherwise. Note: This field must be set to true to search hidden names and email addresses. This class does not validate that the user is in fact an admin, that responsibility is left to the caller of this class.

Returns:
true if the user performing the search is a system administrator, false otherwise.

setAdmin

public void setAdmin(boolean admin)
True if the user performing the search is a system administrator, false otherwise. Note: This field must be set to true to search hidden names and email addresses. This class does not validate that the user is in fact an admin, that responsibility is left to the caller of this class.

Parameters:
admin - true if the user performing the search is a system administrator, false otherwise.

isReturnDisabledUsers

public boolean isReturnDisabledUsers()
Return True if the search returns disabled users.

Returns:
true if the search returns disabled users, false otherwise.

setReturnDisabledUsers

public void setReturnDisabledUsers(boolean returnDisabledUsers)

isReturnExternalUsers

public boolean isReturnExternalUsers()
Return True if the search returns external (Cloud) users.

Returns:
true if the search returns external users, false otherwise.

setReturnExternalUsers

public void setReturnExternalUsers(boolean returnExternalUsers)

isReturnOnlineUsers

public boolean isReturnOnlineUsers()
Return True if the search returns online users only.

Returns:
true if the search returns online users only, false otherwise.

setReturnOnlineUsers

public void setReturnOnlineUsers(boolean returnOnlineUsers)

getInternalQuery

public String getInternalQuery()
Get the internal query used by the search mechanism. Available after the search is performed.

Returns:

setInternalQuery

public void setInternalQuery(String internalQuery)

getStart

public int getStart()
The starting index of returned user results, with respect to total hits. This is used for pagination. Default is zero.

Returns:

setStart

public void setStart(int start)
The starting index of returned user results, with respect to total hits. This is used for pagination. Default is zero.


getRange

public int getRange()
The number of returned user results. Used together with 'start' for pagination. Default is Integer.MAX_VALUE, which will return all available results.

Returns:

setRange

public void setRange(int range)
The number of returned user results. Used together with 'start' for pagination. Default is Integer.MAX_VALUE, which will return all available results.


isReturnProfiles

public boolean isReturnProfiles()
Return UserProfile objects in the ProfileSearchResults, instead of other, lighter-weight user implementations. Default is true.

Returns:

setReturnProfiles

public void setReturnProfiles(boolean returnProfiles)
Return UserProfile objects in the ProfileSearchResults, instead of other, lighter-weight user implementations. Default is true.


isReturnCountOnly

public boolean isReturnCountOnly()
If count only, don't populate userIDs or users in the returned ProfileSearchResults object. Default is false.

Returns:

setReturnCountOnly

public void setReturnCountOnly(boolean returnCountOnly)
If count only, don't populate userIDs or users in the returned ProfileSearchResults object. Default is false.


isReturnUserIDsOnly

public boolean isReturnUserIDsOnly()
If userIDs only, don't populate users in the returned ProfileSearchResults object. Default is false.

Returns:

setReturnUserIDsOnly

public void setReturnUserIDsOnly(boolean returnUserIDsOnly)
If userIDs only, don't populate users in the returned ProfileSearchResults object. Default is false.


getReturnedUserIDs

public Collection<Long> getReturnedUserIDs()
A collection of userids returned by a search using this query. Normal API usage would be to wait for a ProfileSearchResults object to be returned from the search method of the ProfileSearchManager. This should be used for incremental access to the results of a long-running query.

Returns:

setReturnedUserIDs

public void setReturnedUserIDs(Collection<Long> returnedUserIDs)
Provide a collection that will be used to populate the userIDs returned by a search. Normal API usage would be to wait for a ProfileSearchResults object to be returned from the search method of the ProfileSearchManager. This should be used for incremental access to the results of a long-running query.

Parameters:
returnedUserIDs -

isFiltered

public boolean isFiltered()
Check whether or not this query has filters with non-null values.

Returns:
true, if any non-null filters, false otherwise

isEvilQuery

public boolean isEvilQuery()
Check whether or not this query is dangerous.

Returns:
if query is OK or not.

Jive Product Page

Copyright © 1999-2007 Jive Software.