Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.action
Class SearchAction

java.lang.Object
  extended by com.opensymphony.xwork.ActionSupport
      extended by com.jivesoftware.base.action.JiveActionSupport
          extended by com.jivesoftware.forum.action.ForumActionSupport
              extended by com.jivesoftware.forum.action.SearchAction
All Implemented Interfaces:
AuthTokenAware, EntityAware, UserAware, ForumFactoryAware, Pageable, com.opensymphony.webwork.interceptor.ServletRequestAware, com.opensymphony.webwork.interceptor.ServletResponseAware, com.opensymphony.xwork.Action, com.opensymphony.xwork.LocaleProvider, com.opensymphony.xwork.TextProvider, com.opensymphony.xwork.Validateable, com.opensymphony.xwork.ValidationAware, com.uwyn.rife.continuations.ContinuableObject, java.io.Serializable, java.lang.Cloneable

public class SearchAction
extends ForumActionSupport
implements Pageable

An Action to encapsulate all the logic of searching forum content.

See Also:
Serialized Form

Field Summary
static RelativeDateRange[] DATE_RANGES
           
static RelativeDateRange DEFAULT_DATE_RANGE
           
static int DEFAULT_NUM_RESULTS
           
static int[] RESULT_OPTIONS
           
 
Fields inherited from class com.jivesoftware.forum.action.ForumActionSupport
CANCEL, DISABLED, FATAL, NOTFOUND, SESSION_REFERRER_KEY, UNAUTHORIZED
 
Fields inherited from class com.jivesoftware.base.action.JiveActionSupport
pageUser, request, response
 
Fields inherited from class com.opensymphony.xwork.ActionSupport
LOG
 
Fields inherited from interface com.opensymphony.xwork.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
SearchAction()
           
 
Method Summary
 java.lang.String doDefault()
           
 java.lang.String execute()
          Default implementation of doExecute() method.
 long[] getCategoryID()
           
 boolean getCategorySelected(long cID)
           
 java.lang.String getCorrectedQ()
           
 java.lang.String getCorrectedSearchParams()
          Creates a partial query string which can be used to reconstruct the parameter list that executed a search.
 java.lang.String getDateRange()
           
 RelativeDateRange[] getDateRanges()
          Returns a list of the possible date ranges allowed in a search.
 long[] getForumID()
           
 boolean getForumSelected(long fID)
           
 java.lang.String[] getHighlightedText(QueryResult result)
          Returns a subject and summary with search words highlighted appropriate to the search query string.
 java.lang.String getMessageBodyPreview(ForumMessage message)
          Deprecated. Use getHighlightedText(QueryResult) instead
 java.lang.String getMessageSubjectPreview(ForumMessage message)
          Deprecated. Use getHighlightedText(QueryResult) instead
 int[] getNumResultOptions()
          Returns a list of the result count options.
 int getNumResults()
           
 java.lang.String[] getObjID()
           
 java.lang.String getObjIDValue()
          Returns the single objID value that was searched.
 java.lang.String getQ()
           
 java.lang.String getQenc()
           
 int getRankBy()
          Returns the current method of ranking results.
 int getResultByForumCount(Forum forum)
          Returns the total number of results for the given forum.
 int getResultCount()
          Returns the total number of results for this search.
 ResultFilter getResultFilter()
          Returns a Jive Forums result filter - this gives us a handle on the current index in the list and the number of items per page.
 java.util.Iterator getResults()
          Returns an Iterator of QueryResult objects which represent the results of a search, or an empty iterator if there were no results.
 int getResultStart()
          Returns the number of the first result on a result page.
 java.util.List getSearchedCategories()
          Returns a list of the categories being explictly searched or null if no categories are being explictly searched.
 ForumCategory getSearchedCategory()
          Returns the single category being searched, or null if no categories are being searched or if there is more than one category being searched.
 Forum getSearchedForum()
          Returns the single forum being searched or null if no forum was specified or if there is more than one forum being searched.
 java.util.List getSearchedForums()
          Returns a list of the forums being explicitly searched or null if no forums are being explicitly searched.
 java.util.Iterator getSearchedForumsFromQuery()
          Returns a list of Forums which were searched by the query, even if no forumID was specified.
 User getSearchedUser()
          Returns the user used to filter searches or null if none was specified.
 long getSearchID()
          Returns the search ID for the current search
 java.lang.String getSearchParams()
          Creates a partial query string which can be used to reconstruct the parameter list that executed a search.
 int getStart()
          Returns the starting index in the item list.
 java.lang.String getThreadID()
           
 int getTotalItemCount()
          Returns the total number of items our list/collection/whatever.
 java.lang.String getUserID()
           
 boolean isAdvanced()
           
 boolean isDisplayPerThread()
           
 boolean isSpellSuggestOn()
           
 void setAdvanced(boolean advanced)
           
 void setCategoryID(long[] categoryID)
           
 void setDateRange(java.lang.String dateRange)
           
 void setDisplayPerThread(boolean displayPerThread)
           
 void setForumID(long[] forumID)
           
 void setNumResults(int numResults)
           
 void setObjID(java.lang.String[] objID)
           
 void setQ(java.lang.String q)
           
 void setQenc(java.lang.String qenc)
           
 void setRankBy(int rankBy)
          Sets the method to rank results.
 void setSearchID(long searchID)
          Used to set a previously retrieved searchID.
 void setSpellSuggestOn(boolean spellSuggestOn)
           
 void setStart(int start)
           
 void setThreadID(java.lang.String threadID)
           
 void setUserID(java.lang.String userID)
           
 
Methods inherited from class com.jivesoftware.forum.action.ForumActionSupport
getCanAttach, getCanCreateMessage, getCanCreatePoll, getCanCreatePoll, getCanCreateThread, getCanCreateThread, getCanEdit, getCanEditAttach, getCanEditPoll, getCanEditPoll, getCanEditProfile, getCanEditTags, getCanPostAnnounce, getCanPostAnnounce, getCanRead, getCanRead, getEntityDescriptor, getForumFactory, getPageUser, getReadStatus, getSkinProperty, getThemeName, isAdmin, isAdmin, isAuthor, isAuthor, isMessageModerationOn, isModerator, isModerator, isResourceInTheme, isSystemAdmin, isThreadModerationOn, setForumFactory, setUser
 
Methods inherited from class com.jivesoftware.base.action.JiveActionSupport
getAuthToken, getGuestProperty, getJiveProperty, getLocales, getPageURL, getSession, getText, getText, getTimeZone, getTimeZones, isFailedLookup, isGuest, setAuthToken, setGuestProperty, setLoginAttributes, setPageUser, setServletRequest, setServletResponse
 
Methods inherited from class com.opensymphony.xwork.ActionSupport
addActionError, addActionMessage, addFieldError, clearErrorsAndMessages, clone, doInput, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getLocale, getText, getText, getText, getText, getText, getText, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, pause, setActionErrors, setActionMessages, setFieldErrors, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NUM_RESULTS

public static final int DEFAULT_NUM_RESULTS
See Also:
Constant Field Values

RESULT_OPTIONS

public static final int[] RESULT_OPTIONS

DEFAULT_DATE_RANGE

public static final RelativeDateRange DEFAULT_DATE_RANGE

DATE_RANGES

public static final RelativeDateRange[] DATE_RANGES
Constructor Detail

SearchAction

public SearchAction()
Method Detail

getObjID

public java.lang.String[] getObjID()

setObjID

public void setObjID(java.lang.String[] objID)

getSearchID

public long getSearchID()
Returns the search ID for the current search


setSearchID

public void setSearchID(long searchID)
Used to set a previously retrieved searchID. This should be used when paginating through entries for example or anytime you're re-executing a search already made

Parameters:
searchID -

getCategoryID

public long[] getCategoryID()

setCategoryID

public void setCategoryID(long[] categoryID)

getForumID

public long[] getForumID()

setForumID

public void setForumID(long[] forumID)

getUserID

public java.lang.String getUserID()

setUserID

public void setUserID(java.lang.String userID)

getThreadID

public java.lang.String getThreadID()

setThreadID

public void setThreadID(java.lang.String threadID)

isSpellSuggestOn

public boolean isSpellSuggestOn()

setSpellSuggestOn

public void setSpellSuggestOn(boolean spellSuggestOn)

isDisplayPerThread

public boolean isDisplayPerThread()

setDisplayPerThread

public void setDisplayPerThread(boolean displayPerThread)

isAdvanced

public boolean isAdvanced()

setAdvanced

public void setAdvanced(boolean advanced)

getNumResults

public int getNumResults()

setNumResults

public void setNumResults(int numResults)

getRankBy

public int getRankBy()
Returns the current method of ranking results. Values are one of Query.RELEVANCE, Query.RATING, Query.DATE.


setRankBy

public void setRankBy(int rankBy)
Sets the method to rank results. Supported values are one of Query.RELEVANCE, Query.RATING, Query.DATE.


getDateRange

public java.lang.String getDateRange()

setDateRange

public void setDateRange(java.lang.String dateRange)

getQ

public java.lang.String getQ()

setQ

public void setQ(java.lang.String q)

getQenc

public java.lang.String getQenc()

setQenc

public void setQenc(java.lang.String qenc)

getCorrectedQ

public java.lang.String getCorrectedQ()

getStart

public int getStart()
Description copied from interface: Pageable
Returns the starting index in the item list. This will be within the range of 0 to getTotalItemCount()-1.

Specified by:
getStart in interface Pageable
Returns:
the starting index in the item list.

setStart

public void setStart(int start)

getTotalItemCount

public int getTotalItemCount()
Description copied from interface: Pageable
Returns the total number of items our list/collection/whatever. This number will always be > 0.

Specified by:
getTotalItemCount in interface Pageable
Returns:
the total number of items we're looking at.

getResultFilter

public ResultFilter getResultFilter()
Description copied from interface: Pageable
Returns a Jive Forums result filter - this gives us a handle on the current index in the list and the number of items per page.

Specified by:
getResultFilter in interface Pageable
Returns:
a Forums result filter.

getResultStart

public int getResultStart()
Returns the number of the first result on a result page. For instance, this will return 1 for the first page and 16 on the second (if there are 15 results per page).


getObjIDValue

public java.lang.String getObjIDValue()
Returns the single objID value that was searched. If more than one object was specfied to search null is returned. Null is also returned when no object is specified.

Returns:
the single objID parameter value that was searched.

getForumSelected

public boolean getForumSelected(long fID)

getCategorySelected

public boolean getCategorySelected(long cID)

getSearchedCategory

public ForumCategory getSearchedCategory()
Returns the single category being searched, or null if no categories are being searched or if there is more than one category being searched.

Returns:
the single category being searched, or null if no categories are being searched or if there is more than one category being searched.

getSearchedCategories

public java.util.List getSearchedCategories()
Returns a list of the categories being explictly searched or null if no categories are being explictly searched. A category is implictly searched when a global search is run for example.

Returns:
a list of the categories being searched or null if no categories are searched.

getSearchedForum

public Forum getSearchedForum()
Returns the single forum being searched or null if no forum was specified or if there is more than one forum being searched.

Returns:
the single forum being searched or null if no forum was specified or if there is more than one forum being searched.

getSearchedForums

public java.util.List getSearchedForums()
Returns a list of the forums being explicitly searched or null if no forums are being explicitly searched. A forum is implictly searched when a global search is run for example.

Returns:
a list of the forums being searched or null if no forums are searched.

getDateRanges

public RelativeDateRange[] getDateRanges()
Returns a list of the possible date ranges allowed in a search.

Returns:
a list of the possible date ranges allowed in a search.

getSearchedUser

public User getSearchedUser()
Returns the user used to filter searches or null if none was specified.

Returns:
the user used to filter searches or null if none was specified.

getNumResultOptions

public int[] getNumResultOptions()
Returns a list of the result count options.

Returns:
a list of the result count options.

getSearchParams

public java.lang.String getSearchParams()
Creates a partial query string which can be used to reconstruct the parameter list that executed a search. The query string will not start with a ? or &.

Example: q=foo+bar&objID=3&userID=joe

Only parameters actually used or different from default values will be returned.

Returns:
a partial query string containing parameters of this search.

getCorrectedSearchParams

public java.lang.String getCorrectedSearchParams()
Creates a partial query string which can be used to reconstruct the parameter list that executed a search. The query string will not start with a ? or &.

Example: q=foo+bar&objID=3&userID=joe

Only parameters actually used or different from default values will be returned.

Returns:
a partial query string containing parameters of this search.

getResults

public java.util.Iterator getResults()
Returns an Iterator of QueryResult objects which represent the results of a search, or an empty iterator if there were no results.

Returns:
an Iterator of search results (QueryResult objects) or an empty iterator if no results were found.

getResultCount

public int getResultCount()
Returns the total number of results for this search.

Returns:
the total number of results for this search.

getSearchedForumsFromQuery

public java.util.Iterator getSearchedForumsFromQuery()
Returns a list of Forums which were searched by the query, even if no forumID was specified.

Returns:
the list of Forums, or an empty list if no query was run.

getResultByForumCount

public int getResultByForumCount(Forum forum)
Returns the total number of results for the given forum. If the forum has been configured to display search results grouped by thread, the count returned by this method will reflect the thread numbers, not the message numbers.

Parameters:
forum -
Returns:
the total number of results for the given forum.

getHighlightedText

public java.lang.String[] getHighlightedText(QueryResult result)
Returns a subject and summary with search words highlighted appropriate to the search query string. Terms are highlighted with <span class="jive-hilite">term</span>

Parameters:
result - the QueryResult to highlight
Returns:
an array of highlighted text with the subject being the first element and a summary of the main text as the second element.
Since:
4.0

getMessageSubjectPreview

public java.lang.String getMessageSubjectPreview(ForumMessage message)
Deprecated. Use getHighlightedText(QueryResult) instead

Returns the message's subject where the search term(s) appear.

Returns:
the message's subject where the search term(s) appear.

getMessageBodyPreview

public java.lang.String getMessageBodyPreview(ForumMessage message)
Deprecated. Use getHighlightedText(QueryResult) instead

Returns a snippet of the message's body where the search term(s) appear.

Returns:
a snippet of the message's body where the search term(s) appear.

doDefault

public java.lang.String doDefault()
Overrides:
doDefault in class com.opensymphony.xwork.ActionSupport

execute

public java.lang.String execute()
Description copied from class: ForumActionSupport
Default implementation of doExecute() method. This class is intended to be a base class for other actions but can be used as an action itself if the skin author simply wants to get access to the context & methods provided by this class.

Specified by:
execute in interface com.opensymphony.xwork.Action
Overrides:
execute in class ForumActionSupport
Returns:
Action.SUCCESS

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.