Oracle Collaboration Suite Discussions Java API Reference
10g (10.1.1)

Part No. B16232-01


oracle.discussions.sdk
Class TdSearchTerm

java.lang.Object
  extended byoracle.discussions.sdk.TdSearchTerm


public class TdSearchTerm
extends java.lang.Object

Defines the query criteria for a search in Oracle Discussions.

The query criteria can be applied a Facility and Board or a Thread.
The query string will be matched on the author of the message, the message subject and the message body - with or without attachement matching depending on the server settings.
Cannot be applied to search on TdThread and TdMessage objects.

Sample code snippet illustrating the usage of TdSearchTerm

 //Create a default TdSearchTerm.
  TdSearchTerm tdst = TdSearchTerm.getDefaultSearchTerm("");
 //Set various search criterion.
 tdst.setQuery(keyword);
 tdst.setNumberOfReplies(iNumReplies);
 tdst.setHasAttachments(bHasAttachments);
 //Invoke a search function using search term globally.
 tdStore.search(tdst);
 
Since:
OCS 10.1.1

Field Summary
static int ANY_DATE_RANGE
Represents any date range.
static int IS_NEW
Represents that the search is based on messages posted after user's last logout time and current time.
static int WITHIN_ONE_DAY
Represents that the search is based on messages posted within one day before and after the choosen date.
static int WITHIN_ONE_MONTH
Represents that the search is based on messages posted within one month before and after the choosen date.
static int WITHIN_ONE_WEEK
Represents that the search is based on messages posted within one week before and after the choosen date.
static int WITHIN_ONE_YEAR
Represents that the search is based on messages posted within one year before and after the choosen date.

Method Summary
boolean equals(java.lang.Object obj)
Compares one search term with another.
static TdSearchTerm getDefaultSearchTerm(java.lang.String query)
Returns the default search term implementation.
int getMinimalMessageSize()
Gets minimal size of the message.
int getNumberOfReplies()
Gets number of replies.
java.lang.String getQuery()
Returns the query string used by this search term.
java.util.Date getStartDate()
Returns the start query date: only messages posted after this date will be searched.
java.util.Date getStopDate()
Returns the stop query date: only messages posted before this date will be searched.
java.lang.String getUsername()
Returns the username: only messages posted by username will be searched
boolean hasAttachments()
Returns true if only messages with attachments will be returned from search, false will put no restriction on message attachments
int hashCode()
Returns the combined hashcode of different fields in the search term.
boolean isNew()
Returns true if only messages posted later than user's last logout time will be returned from search, false will put no restriction on message post date.
void setDateRange(int iDateRange)
A convenient method to set the start date and stop date The date range will center around the date the is currently set as the start date.
void setHasAttachments(boolean bHasAttachments)
Sets has_attachments flag.
void setMinimalMessageSize(int iMinMsgSize)
Sets minimal size of the message.
void setNew(boolean bIsNew)
Sets is_new flag.
void setNumberOfReplies(int iNumReplies)
Sets number of replies.
void setQuery(java.lang.String query)
Sets the query string used by this search term.
void setStartDate(java.util.Date dStartDate)
Sets the start query date: only messages posted after this date will be searched.
void setStopDate(java.util.Date dStopDate)
Sets the stop query date: only messages posted before this date will be searched.
void setUsername(java.lang.String username)
Sets the username: only messages posted by username will be searched.

Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait

Field Detail

ANY_DATE_RANGE

public static final int ANY_DATE_RANGE
Represents any date range.

Indicates that search is not consrained by start and end dates.

See Also:
Constant Field Values

IS_NEW

public static final int IS_NEW
Represents that the search is based on messages posted after user's last logout time and current time.
See Also:
Constant Field Values

WITHIN_ONE_DAY

public static final int WITHIN_ONE_DAY
Represents that the search is based on messages posted within one day before and after the choosen date.

For example, if the chosen date is 24-Jul-2005, then search is based on dates ranging from 23-Jul-2005 to 25-Jul-2005 inclusive.

See Also:
Constant Field Values

WITHIN_ONE_WEEK

public static final int WITHIN_ONE_WEEK
Represents that the search is based on messages posted within one week before and after the choosen date.

For example, if the chosen date is 24-Jul-2005, then search is based on dates ranging from one week before 24-Jul-2005 to One week after 24-Jul2005, end dates inclusive.

See Also:
Constant Field Values

WITHIN_ONE_MONTH

public static final int WITHIN_ONE_MONTH
Represents that the search is based on messages posted within one month before and after the choosen date.

For example, if the chosen date is 24-Jul-2005, then search is based on dates ranging from one month before 24-Jul-2005 to One month after 24-Jul2005, end dates inclusive.

See Also:
Constant Field Values

WITHIN_ONE_YEAR

public static final int WITHIN_ONE_YEAR
Represents that the search is based on messages posted within one year before and after the choosen date.

For example, if the chosen date is 24-Jul-2005, then search is based on dates ranging from one year before 24-Jul-2005 to One year after 24-Jul2005, end dates inclusive.

See Also:
Constant Field Values

Method Detail

getDefaultSearchTerm

public static TdSearchTerm getDefaultSearchTerm(java.lang.String query)
Returns the default search term implementation. The default search term will search all the message in the container with no user or date filtering for the supplied query. The results will be sorted by score in descending order.
Parameters:
query - the query on which search is based.

getQuery

public java.lang.String getQuery()
Returns the query string used by this search term.
Returns:
String search query

getUsername

public java.lang.String getUsername()
Returns the username: only messages posted by username will be searched
Returns:
String the usernameon which search is based.

getStartDate

public java.util.Date getStartDate()
Returns the start query date: only messages posted after this date will be searched.
Returns:
Date Messages posted after this date are only searched.

getStopDate

public java.util.Date getStopDate()
Returns the stop query date: only messages posted before this date will be searched.
Returns:
Date messages posted till this date only are searched.

setQuery

public void setQuery(java.lang.String query)
Sets the query string used by this search term.
Parameters:
query - search query

setStartDate

public void setStartDate(java.util.Date dStartDate)
Sets the start query date: only messages posted after this date will be searched.
Parameters:
dStartDate - messages posted after this date are searched.

setUsername

public void setUsername(java.lang.String username)
Sets the username: only messages posted by username will be searched.
Parameters:
username - username on which search is based.

setStopDate

public void setStopDate(java.util.Date dStopDate)
Sets the stop query date: only messages posted before this date will be searched.
Parameters:
dStopDate - indicates the max date upto whichsearch is based.

setNumberOfReplies

public void setNumberOfReplies(int iNumReplies)
Sets number of replies.
Parameters:
iNumReplies - integer representing the number of replies per message on which the search is based.

getNumberOfReplies

public int getNumberOfReplies()
Gets number of replies.
Returns:
int integer representing number of replies in the search criteria.

setMinimalMessageSize

public void setMinimalMessageSize(int iMinMsgSize)
Sets minimal size of the message.
Parameters:
iMinMsgSize - integer representing the minimal message size icluded in the search.

getMinimalMessageSize

public int getMinimalMessageSize()
Gets minimal size of the message.
Returns:
int integer representing the minimal message size in the search criteria.

setHasAttachments

public void setHasAttachments(boolean bHasAttachments)
Sets has_attachments flag.
Parameters:
bHasAttachments - boolean status indicating if the search criteria includes messages with attachments.

hasAttachments

public boolean hasAttachments()
Returns true if only messages with attachments will be returned from search, false will put no restriction on message attachments
Returns:
boolean status indicating if the search criterion includes messages with attachments.

setNew

public void setNew(boolean bIsNew)
Sets is_new flag.
Parameters:
bIsNew - Indicates if the search term is new.

isNew

public boolean isNew()
Returns true if only messages posted later than user's last logout time will be returned from search, false will put no restriction on message post date. This condition will also combine with start date and stop date if set.

setDateRange

public void setDateRange(int iDateRange)
A convenient method to set the start date and stop date The date range will center around the date the is currently set as the start date. (e.g.: if start date is currently 01/28/05 and the range is WITHIN_ONE_DAY, the new start date will be 01/27/05 and new end date will be 01/29/05)
Parameters:
iDateRange - Teh date range to be set.

equals

public boolean equals(java.lang.Object obj)
Compares one search term with another.

Extracts individual fields of both the search terms and compares them for equality.
If all the fields match, then the terms are said to be equal.
Otherwise, they are said to be unequal.

Parameters:
obj - the search term to be compared with another.
Returns:
boolean value indicating the equality.

hashCode

public int hashCode()
Returns the combined hashcode of different fields in the search term.

Used in comparing one search term with another for equality.
If the hash codes are equal, then the search terms are equal and if the hash codes differ, the search terms are considered to be unequal.

Returns:
int

Copyright © 2005, Oracle. All rights reserved.