Package wt.query

Class IntegratedSearchTask

java.lang.Object
wt.query.IntegratedSearchTask
All Implemented Interfaces:
Externalizable, Serializable

public class IntegratedSearchTask extends Object implements Externalizable
Provides a search API for the client to use to get paged, sorted, and integrated database and content searches. The session id is used to get back the next page of a search that has already been executed. If the session isn't accessed in a while the session id will be timed out and the search results will not be available. After a search session id is no longer needed then the closeSession method should be used to close the session. The session id should be retrieved by using getSessionID after a successful call to search. The session id should be saved and then used to retrieve the next page if the IntegratedSearchTask instance that initiated the search can not be saved. Calling search and specifying a pageOffset will retrieve that page. The first page is offset of 0. This class is being implemented to support the increased functionality of the HTML Search for release 6. This class will be superseded in release 7 and will probably be deprecated in that release or shortly after.

Supported API: true

Extendable: false
See Also:
  • Field Details

  • Constructor Details

    • IntegratedSearchTask

      public IntegratedSearchTask()
      Get a new instance of IntegratedSearchTask to use for new searches.

      Supported API: true
    • IntegratedSearchTask

      public IntegratedSearchTask(long a_sessionID)
      Get a new instance of IntegratedSearchTask to use with a previous paging session. The total size of the query results will be set to -1 until a successful retrieval of a page from the database.

      Supported API: true
      Parameters:
      a_sessionID - Session id for an existing paging session. Retrieved from a previous search of IntegratedSearchTask. Session ids will automatically time out if not used for a period of time. Paging sessions that are no longer needed should be closed.
  • Method Details

    • clearSession

      public void clearSession()
      Closes an older session and clears the session id and total size attributes in preparation for a new search.

      Supported API: true
    • closeSession

      public void closeSession() throws WTException
      Used to close a database paging session.

      Supported API: true
      Throws:
      WTException
    • search

      public QueryResult search(Vector classnames, Hashtable criteria, String keyword, Vector displayAttributes, Vector sortKeys, int pageRange, String searchFilter, Vector contentLibrary, Locale locale) throws WTException
      Will execute a search against the content search engine and the database search using all of the parameters. Will do a fresh search and reset the session id for the paging session. Returns the first page of the search.

      Supported API: true
      Parameters:
      classnames - A list of the classes (of type Class not String) that this search will use in a compound search. All of the criteria attributes and the sorting attributes must be the same for each of the classes in the list. The sorting must be in the same order and the types of the attributes must be the same.
      criteria - A series of name value pairs of type String that specify the search criteria. The "keyword" name with a value for the string specifies the keyword used in the content search.
      keyword - String used to search against the content search engine. If this string is null no content search will be run. Set this string to null if there is no content search engine installed on the system.
      displayAttributes - List of attributes that are used to inflate the attribute values after a search.
      sortKeys - List of sort key strings that the results should be sorted in. The keys are ordered with the first sort key being the first in the list. The string is of the format: : Where attribute name is the name of the column to be sorted on and descending is a boolean that specifies true for descending and false for ascending order. False is the default if no value is specified.
      pageRange - For the database paging of the search results this sets the size of a page.
      searchFilter - Can be set to either ALL_VERSIONS or ALL_ITERATIONS. The ALL_VERSIONS will return the latest iteration of each of the versions for the iterated object. ALL_ITERATIONS will return all iterations of all versions of the iterated object.
      contentLibrary - A list of the content libraries which the content search should be executed against.
      locale - Locale of the client that is executed this method.
      Returns:
      QueryResult
      Throws:
      WTException
    • search

      @Deprecated public QueryResult search(Vector classnames, Hashtable criteria, String keyword, Vector displayAttributes, Vector sortKeys, int pageOffset, int pageRange, String searchFilter, Vector contentLibrary, Locale locale) throws WTException
      Deprecated.
      Will execute a search against the content search engine and the database search using all of the parameters. If there already is a session id set on this class then this method will first attempt to retrieve the page specified by the pageOffset parameter. If the attempt to retrieve the page fails due to the session having already been timed out this method will reexecute the search using the specified criteria. This class does not save the criteria for the session so if the criteria is changed and the session id is valid it will not execute the new criteria. If a new search is desired then the session id should be cleared with clearSession method and then call this method or the other search method should be used.

      Supported API: true
      Parameters:
      classnames - A list of the classes (of type Class not String) that this search will use in a compound search. All of the criteria attributes and the sorting attributes must be the same for each of the classes in the list. The sorting must be in the same order and the types of the attributes must be the same.
      criteria - A series of name value pairs of type String that specify the search criteria. The "keyword" name with a value for the string specifies the keyword used in the content search.
      keyword - String used to search against the content search engine. If this string is null no content search will be run. Set this string to null if there is no content search engine installed on the system.
      displayAttributes - List of attributes that are used to inflate the attribute values after a search or retrieval of a page.
      sortKeys - List of sort key strings that the results should be sorted in. The keys are ordered with the first sort key being the first in the list. The string is of the format: : Where attribute name is the name of the column to be sorted on and descending is a boolean that specifies true for descending and false for ascending order. False is the default if no value is specified.
      pageOffset - For the database paging of the search results this is the page offset into the results that is being requested. If the session id has been set to a valid session then a new query is not done but the offset is used to return a specific page of the query results. The first page is 0.
      pageRange - For the database paging of the search results this sets the size of a page.
      searchFilter - Can be set to either ALL_VERSIONS or ALL_ITERATIONS. The ALL_VERSIONS will return the latest iteration of each of the versions for the iterated object. ALL_ITERATIONS will return all iterations of all versions of the iterated object.
      contentLibrary - A list of the content libraries which the content search should be executed against.
      locale - Locale of the client that is executed this method.
      Returns:
      QueryResult
      Throws:
      WTException
    • getPage

      public QueryResult getPage(int offset, int range, Vector displayAttributes) throws WTException
      Get the specified page from an existing search results. Returns an exception if the session has timed out. Do a the search again and specify the page of the search if the session times out.

      Supported API: true
      Parameters:
      offset - For the database paging of the search results this is the page offset into the results that is being requested. The first page is 0, the second is 1, ....
      range - For the database paging of the search results this sets the size of a page.
      displayAttributes - List of attributes that are used to inflate the attribute values after a search or retrieval of a page.
      Returns:
      QueryResult
      Throws:
      WTException
    • getSessionID

      public long getSessionID()
      Return the session id of this paging session. A valid session id can only be retrieved after search has been called to do a database search or a session id has been set from a previous IntegratedSearchTask instance. The session id should be saved if the IntegratedSearchTask instance that generated the search is not kept. Use the IntegratedSearchTask(sessionID) constructor to recapture the old session. Paging sessions are automatically timed out by the database so a new search may be necessary if too much time has elapsed between requests for pages. Use closeSession to close a paging session after it is no longer needed.

      Supported API: true
      Returns:
      long
    • getTotalSize

      public int getTotalSize()
      Return the total number of objects in the search results. This method will return -1 if this instance of IntegratedSearchTask was just created and no connection to the search results has been attempted. Either of the search methods or the getPage method will set the totalSize attribute and then a call to this method will return the number of objects in the full search results.

      Supported API: true
      Returns:
      int
    • limitedSearch

      public QueryResult limitedSearch(Vector classnames, Hashtable criteria, String keyword, Vector displayAttributes, Vector sortKeys, int pageOffset, int pageRange, String searchFilter, Vector contentLibrary, Locale locale) throws WTException
      Executes an intentionally limited search against the database search using all of the parameters. This method is introduced to allow for globally present textbox search in Solutions that do not have RWare-enabled Integrated Search. The database is searched for 'name' OR 'number' against the keyword. Will do a fresh search and reset the session id for the paging session. Returns the first page of the search.

      Supported API: true
      Parameters:
      classnames - A list of the classes (of type Class not String) that this search will use in a compound search. All of the criteria attributes and the sorting attributes must be the same for each of the classes in the list. The sorting must be in the same order and the types of the attributes must be the same.
      criteria - A series of name value pairs of type String that specify the search criteria. The "keyword" name with a value for the string specifies the keyword used in the content search.
      keyword - String used to search against the content search engine. If this string is null no content search will be run. Set this string to null if there is no content search engine installed on the system.
      displayAttributes - List of attributes that are used to inflate the attribute values after a search or retrieval of a page.
      sortKeys - List of sort key strings that the results should be sorted in. The keys are ordered with the first sort key being the first in the list. The string is of the format: : Where attribute name is the name of the column to be sorted on and descending is a boolean that specifies true for descending and false for ascending order. False is the default if no value is specified.
      pageOffset - For the database paging of the search results this is the page offset into the results that is being requested. If the session id has been set to a valid session then a new query is not done but the offset is used to return a specific page of the query results. The first page is 0.
      pageRange - For the database paging of the search results this sets the size of a page.
      searchFilter - Can be set to either ALL_VERSIONS or ALL_ITERATIONS. The ALL_VERSIONS will return the latest iteration of each of the versions for the iterated object. ALL_ITERATIONS will return all iterations of all versions of the iterated object.
      contentLibrary - A list of the content libraries which the content search should be executed against.
      locale - Locale of the client that is executed this method.
      Returns:
      QueryResult
      Throws:
      WTException