|
Jive Forums API (5.5.8) Developer Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jivesoftware.forum.database.DbQuery
public class DbQuery
Database implementation of the Query interface using Lucene. The maximum number of search results can be set using the Jive property search.maxResultsSize. The default value is 1500.
| Field Summary | |
|---|---|
protected java.util.Date |
afterDate
|
protected java.util.Date |
beforeDate
|
protected long |
filteredUserID
|
protected long[] |
forumIDs
|
protected static int |
MAX_RESULTS_SIZE
The maximum number of results to return with a search. |
protected long |
threadID
|
| Fields inherited from interface com.jivesoftware.forum.Query |
|---|
ASCENDING, DATE, DESCENDING, RATING, RELEVANCE, SUBJECT |
| Constructor Summary | |
|---|---|
DbQuery(Forum[] forums)
|
|
DbQuery(long id)
Load an existing query. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
|
boolean |
equals(Query query)
Return true if the query is equal to the current query, false otherwise. |
static java.lang.String |
escapeBadCharacters(java.lang.String queryString)
This method escapes characters that would otherwise potentially cause a query to be malformed. |
void |
filterOnThread(ForumThread thread)
Restricts the querty results to messages posted in a specified thread. |
void |
filterOnUser(User user)
Restricts the query results to messages posted 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. |
int |
getCachedSize()
Returns the approximate size of the Object in bytes. |
ForumThread |
getFilteredThread()
Returns the thread that query results are restricted to. |
User |
getFilteredUser()
Returns the user that query results are restricted to. |
long[] |
getForumIDs()
Returns an array of forumID's denoting the forums that will be searched within. |
Forum[] |
getForums()
|
long |
getID()
Retrieve the unique identifier for the query. |
int |
getObjectType()
Return the object type of the query. |
java.lang.String |
getQueryString()
Returns the query string for the Query object. |
int |
getResultByThreadCount()
Returns the total number of threads that contain query results. |
int |
getResultCount()
Returns the total number of results of the query. |
int |
getResultForumCount(Forum forum)
Returns the number of results in the search that match the given forum. |
int |
getResultForumCountByThread(Forum forum)
Returns the number of results in the search that match the given forum where search results are grouped by thread. |
java.util.Iterator |
getResultForums()
Returns an Iterator of the Forums that search results are from. |
java.util.Iterator |
getResults()
Returns the results of the query as an Iterator of QueryResult objects. |
java.util.Iterator |
getResults(int startIndex,
int numResults)
Returns the results of the Query as an Iterator of QueryResult objects. |
java.util.Iterator |
getResultsByThread()
Returns the results of the Query as an Iterator of QueryResult objects. |
java.util.Iterator |
getResultsByThread(int startIndex,
int numResults)
Returns the results of the Query as an Iterator of QueryResult objects. |
java.util.Date |
getSearchDate()
|
int |
getSearchDuration()
|
int |
getSortField()
Returns the currently selected sort field. |
int |
getSortOrder()
Returns the sort order, which will be Query.ASCENDING for ascending sorting, or Query.DESCENDING for descending sorting. |
User |
getUser()
Returns the user that is executing the search. |
long |
getUserID()
|
int |
hashCode()
|
java.lang.String[] |
highlightResult(QueryResult result,
java.lang.String preTag,
java.lang.String postTag)
Returns a title and summary with search words highlighted appropriate to the search query string. |
long |
logQuery(User user)
Logs the query for later statistical analysis. |
void |
logSearchClick(long searchID,
long messageID)
Logs a search result clickthrough. |
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 |
setQueryString(java.lang.String queryString)
Sets the query string for the Query object. |
void |
setSortField(int sortField)
Sets the sort field to use. |
void |
setSortOrder(int sortOrder)
Sets the sort type. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int MAX_RESULTS_SIZE
protected long filteredUserID
protected long[] forumIDs
protected long threadID
protected java.util.Date beforeDate
protected java.util.Date afterDate
| Constructor Detail |
|---|
public DbQuery(Forum[] forums)
public DbQuery(long id)
throws NotFoundException
id - the id of the query to load
NotFoundException - if the Query cannot be retrieved from the database| Method Detail |
|---|
public long getID()
Query
getID in interface Querypublic long getUserID()
public User getUser()
Query
getUser in interface Querypublic int getObjectType()
Query
getObjectType in interface Querypublic java.util.Date getSearchDate()
public int getSearchDuration()
public Forum[] getForums()
public void setQueryString(java.lang.String queryString)
Query
setQueryString in interface QueryqueryString - a new query string.public java.lang.String getQueryString()
Query
getQueryString in interface Querypublic void setBeforeDate(java.util.Date beforeDate)
Query
setBeforeDate in interface QuerybeforeDate - an upper date boundary for search results.public java.util.Date getBeforeDate()
QueryIf the "before date" has not been set, this method will return null.
getBeforeDate in interface Querypublic void setAfterDate(java.util.Date afterDate)
Query
setAfterDate in interface QueryafterDate - a lower date boundary for search results.public java.util.Date getAfterDate()
QueryIf the "after date" has not been set, this method will return null.
getAfterDate in interface Querypublic long[] getForumIDs()
Query
getForumIDs in interface Querypublic User getFilteredUser()
Query
getFilteredUser in interface Querypublic void filterOnUser(User user)
QuerygetUserMessages method for a user's
messages among all forums.
filterOnUser in interface Queryuser - a User to restrict query results to.ResultFilterpublic ForumThread getFilteredThread()
Query
getFilteredThread in interface Querypublic void filterOnThread(ForumThread thread)
Query
filterOnThread in interface Querythread - the ForumThread to restrict query results to.public int getSortField()
Query
getSortField in interface Querypublic void setSortField(int sortField)
Query
setSortField in interface QuerysortField - the field that will be used for sorting.public int getSortOrder()
Query
getSortOrder in interface Querypublic void setSortOrder(int sortOrder)
Query
setSortOrder in interface QuerysortOrder - the order that results will be sorted in.public int getResultCount()
Query
getResultCount in interface Querypublic int getResultByThreadCount()
Query
getResultByThreadCount in interface Querypublic java.util.Iterator getResults()
Query
getResults in interface QueryQueryResult
public java.util.Iterator getResults(int startIndex,
int numResults)
QueryIf startIndex or numResults does not fall within the range of results, the number of messages returned may be smaller than expected. For example, suppose a query has a total of 17 results. If startIndex is 0 and numResults is 25, only 17 results can be returned.
getResults in interface QuerystartIndex - the index in the results that the iterator will start at.numResults - the max number of results that should be returned.
QueryResultpublic java.util.Iterator getResultsByThread()
Query
getResultsByThread in interface Query
public java.util.Iterator getResultsByThread(int startIndex,
int numResults)
QueryIf startIndex or numResults does not fall within the range of results, the number of messages returned may be smaller than expected. For example, suppose a query has a total of 17 results. If startIndex is 0 and numResults is 25, only 17 results can be returned.
getResultsByThread in interface QuerystartIndex - the index in the results that the iterator will start at.numResults - the maximum number of results that should be returned.
public java.util.Iterator getResultForums()
Query
getResultForums in interface Querypublic int getResultForumCount(Forum forum)
Query
getResultForumCount in interface Querypublic int getResultForumCountByThread(Forum forum)
Query
getResultForumCountByThread in interface Query
public java.lang.String[] highlightResult(QueryResult result,
java.lang.String preTag,
java.lang.String postTag)
QueryQuery.getResults() or
Query.getResults(int, int).
highlightResult in interface Queryresult - the QueryResult to highlightpreTag - a tag to be used to mark the beginning of highlighted text eg <B%gt;postTag - a tag to be used to mark the beginning of highlighted text eg </B%gt;
public long logQuery(User user)
QueryNote: This method is a noop in Jive Forums Lite and Professional.
logQuery in interface Queryuser - the user performing the query, or null if a guest is performing the search.
public void logSearchClick(long searchID,
long messageID)
QueryNote: This method is a noop in Jive Forums Lite and Professional.
logSearchClick in interface QuerysearchID - the searchID of the search associated with the clickthrough.messageID - the messageID of the search result that was clickedpublic int getCachedSize()
Cacheable
getCachedSize in interface Cacheablepublic boolean equals(Query query)
Query
equals in interface Queryquery - the query to compare to the current query
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic static java.lang.String escapeBadCharacters(java.lang.String queryString)
|
Jive Forums Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||