Oracle Content Management SDK

oracle.ifs.beans
Class Search

java.lang.Object
  |
  +--oracle.ifs.beans.Search

public final class Search
extends java.lang.Object

The Search class provides a way to search for objects. A Search is specified by a SearchSpecification. To execute a Search use the open, next & close functions.

See Also:
SearchSpecification, AttributeSearchSpecification, ContextSearchSpecification, SearchResultObject

Constructor Summary
  Search(LibrarySession sess, SearchSpecification sp)
          Constructs a Search object.
 
Method Summary
 void close()
          Closes the search.
 void dispose()
          Disposes this Search.
 int getItemCount()
          Returns the number of rows in search result.
 int getItemCount(AttributeValue[] bindValues)
          Returns the number of rows in search result.
 int getItemCount(AttributeValue[] bindValues, java.lang.String language)
          Returns the number of rows in search result.
 int getItemCount(AttributeValue[] bindValues, java.lang.String language, int timeout)
          Returns the number of rows in search result.
 int getItemCount(java.lang.String language)
          Returns the number of rows in search result.
 SearchSpecification getSearchSpecification()
          Returns the SearchSpecification of this Search.
 java.lang.String getSQL()
          Returns the SQL query generated by the search.
 SearchResultObject next()
          Returns the next result row.
 void open()
          Opens the Search.
 void open(AttributeValue[] bindValues)
          Opens the Search.
 void open(AttributeValue[] bindValues, java.lang.String language)
          Opens the Search.
 void open(AttributeValue[] bindValues, java.lang.String language, int timeout)
          Opens the Search.
 void open(java.lang.String language)
          Opens the Search.
 void setSearchSpecification(SearchSpecification sp)
          Set the SearchSpecification.
 

Constructor Detail


Search

public Search(LibrarySession sess,
              SearchSpecification sp)
       throws IfsException
Constructs a Search object.
Parameters:
sess - LibrarySession in which Search will execute.
sp - SearchSpecification defining Search. The SearchSpecification is cloned, any changes in SearchSpecification after constructing a Search will not be picked up.
Throws:
IfsException - 21000 if sess is not valid; 19001 if sp is not valid
Method Detail

setSearchSpecification

public void setSearchSpecification(SearchSpecification sp)
                            throws IfsException
Set the SearchSpecification. If the search was previosly opened, exisitng cached items and cursors are closed. The SearchSpecification is cloned. Therefore, any changes to it after calling this method will not affect the outcome of the search.
Parameters:
sp - SearchSpecification defining Search.
Throws:
IfsException - 19001 if sp is not valid

getSearchSpecification

public SearchSpecification getSearchSpecification()
                                           throws IfsException
Returns the SearchSpecification of this Search.
Returns:
the SearchSpecification
Throws:
IfsException - if the operation fails

open

public void open()
          throws IfsException
Opens the Search. This executes the Search and sets the cursor to the top of the ResultSet. Calls open(null, null). Assumes no bind values and language defaults to the sessions default.
Throws:
IfsException - if the operation fails.

open

public void open(java.lang.String language)
          throws IfsException
Opens the Search. This executes the Search and sets the cursor to the top of the ResultSet. This allows a specific session language to be used for searches.
Parameters:
langauge - language to be used for search
Throws:
IfsException - if open fails

open

public void open(AttributeValue[] bindValues)
          throws IfsException
Opens the Search. This executes the Search and sets the cursor to the top of the ResultSet. Users can specify the bind values. Default language will be used. Calls open(bindValues, null).
Parameters:
bindValues - array of late bound values
Throws:
IfsException - if open fails

open

public void open(AttributeValue[] bindValues,
                 java.lang.String language)
          throws IfsException
Opens the Search. This executes the Search and sets the cursor to the top of the ResultSet. Users can specify the bind values and the session language.
Parameters:
bindValues - array of late bound values
language - language to be used for the search
Throws:
IfsException - if open fails

open

public void open(AttributeValue[] bindValues,
                 java.lang.String language,
                 int timeout)
          throws IfsException
Opens the Search. This executes the Search and sets the cursor to the top of the ResultSet. Users can specify the bind values, session language and timeout value.
Parameters:
bindValues - array of late bound values
language - language to be used for the search
timeout - search will timeout after this number of seconds
Throws:
IfsException - if open fails

getItemCount

public int getItemCount()
                 throws IfsException
Returns the number of rows in search result. Calls getItemCount(null, null). Assumes no bind values and language defaults to the sessions default. Runs a select count(*) query to get the count. This does NOT cache the result. Repeated calls to this method in the same search object result in database query everytime. The number of items returned here is not guaranteed to match the number of items found, when the actual search is run. This is because, objects might be created or deleted between the time when getItemCount() is called and the actual search is run by calling open(). When getItemCount() is called on a Search that is setup to remove duplicates, the number returned is the total number of distinct first result class type objects in the result set.
Returns:
Number of items in search result set.
Throws:
IfsException - if the operation fails.

getItemCount

public int getItemCount(java.lang.String language)
                 throws IfsException
Returns the number of rows in search result. This allows a specific session language to be used. Runs a select count(*) query to get the count. This does NOT cache the result. Repeated calls to this method in the same search object result in database query everytime. The number of items returned here is not guaranteed to match the number of items found, when the actual search is run. This is because, objects might be created or deleted between the time when getItemCount() is called and the actual search is run by calling open().
Parameters:
langauge - language to be used for search
Returns:
Number of items in search result set.
Throws:
IfsException - if the operation fails.

getItemCount

public int getItemCount(AttributeValue[] bindValues)
                 throws IfsException
Returns the number of rows in search result. Users can specify the bind values. Default language will be used. Calls getItemCount(bindValues, null). Runs a select count(*) query to get the count. This does NOT cache the result. Repeated calls to this method in the same search object result in database query everytime. The number of items returned here is not guaranteed to match the number of items found, when the actual search is run. This is because, objects might be created or deleted between the time when getItemCount() is called and the actual search is run by calling open().
Parameters:
bindValues - array of late bound values
Returns:
Number of items in search result set.
Throws:
IfsException - if the operation fails.

getItemCount

public int getItemCount(AttributeValue[] bindValues,
                        java.lang.String language)
                 throws IfsException
Returns the number of rows in search result. Users can specify the bind values and the session language. Runs a select count(*) query to get the count. This does NOT cache the result. Repeated calls to this method in the same search object result in database query everytime. The number of items returned here is not guaranteed to match the number of items found, when the actual search is run. This is because, objects might be created or deleted between the time when getItemCount() is called and the actual search is run by calling open().
Parameters:
bindValues - array of late bound values
language - language to be used for the search
Returns:
Number of items in search result set.
Throws:
IfsException - if the operation fails.

getItemCount

public int getItemCount(AttributeValue[] bindValues,
                        java.lang.String language,
                        int timeout)
                 throws IfsException
Returns the number of rows in search result. Users can specify the bind values, session language and timeout value. Runs a select count(*) query to get the count. This does NOT cache the result. Repeated calls to this method in the same search object result in database query everytime. The number of items returned here is not guaranteed to match the number of items found, when the actual search is run. This is because, objects might be created or deleted between the time when getItemCount() is called and the actual search is run by calling open().
Parameters:
bindValues - array of late bound values
language - language to be used for the search
timeout - search will timeout after this amount of time
Returns:
Number of items in search result set.
Throws:
IfsException - if the operation fails.

getSQL

public java.lang.String getSQL()
                        throws IfsException
Returns the SQL query generated by the search. Developers can use this to debug their search tree. The SQL generated does not have bind values filled in. These include the bind values used to handle security.
Returns:
the SQL generated by the search.
Throws:
IfsException - if the operation fails

next

public SearchResultObject next()
                        throws IfsException
Returns the next result row. The result row is returned as a SearchResultObject. Depending on the SearchSepcification, the result row can contain one or more LibraryObjects, it also contains information about Context Scores.
Returns:
SearchResultObject corresponding to the next row of the cursor.
Throws:
IfsException - IFS-22000 if there is no more rows in the search results.
See Also:
SearchResultObject

close

public void close()
           throws IfsException
Closes the search. You cannot get any more search results after calling this method. Closes the database cursor held by the search. All open() calls should have matching close() calls.
Throws:
IfsException - if operation fails

dispose

public void dispose()
             throws IfsException
Disposes this Search.

Dispose a search to fully release its resources. If opened, the Search is closed. Once disposed, the Search cannot be reopened.

Throws:
IfsException - if the operation fails

Oracle Content Management SDK

(c) 2002 Copyright Oracle Corporation. All rights reserved.