Skip navigation links

Oracle® Ultra Search Java API Reference
11g Release 1 (11.1)

B28329-02


oracle.ultrasearch.query
Class Instance

java.lang.Object
  extended by oracle.ultrasearch.query.Instance

Direct Known Subclasses:
QueryInstance

public class Instance
extends java.lang.Object

An instance to search on.

A search instance defines a connection to the database backend. From the instance object, attributes, groups, and attribute LOVs can be fetched from using getMetaData method. Searches can be performed using getResult method. Additional URLs can be added to the database backend for future crawling and indexing using the submitUrl method.

The meta-data information is cached to avoid round-trips to the database backend. The cache refresh interval is an adjustable property. The default interval is at most every 15 mins.

Instance also performs URL substitution for email, table, or file documents. By substituting the beginning portion of a URL to point to an established web application, users can browse email, table and file documents found in the search result.

Since:
9.0.2
See Also:
InstanceMetaData, Attribute, Group, AttributeLOV

Constructor Summary
Instance()
          Construct an instance for searching.

 

Method Summary
 void clearCache()
          Empty the meta-data cache, so the next call to getMetaData() will need to connect to the backend.
 int estimateHitCount(Query query, java.util.Locale qryLang, java.util.Locale docLang)
          Estimate the total number of hits for a query.
 java.sql.Connection getConnection()
          Get the Connection object used to connect to this instance.
 java.lang.String getFilePagePath()
          Gets the URL path of the web application (JSP or Servlet) that will render the contents of a file.
 java.lang.String getInstanceName()
          Get the instance name is used.
 java.lang.String getMailPagePath()
          Gets the URL path of the web application (JSP or Servlet) that will render the contents of an email.
 InstanceMetaData getMetaData()
          Get the meta data associated with the query instance.
 int getRefreshInterval()
          Gets the interval by which meta data is refreshed.
 Result getResult(Query query, java.util.Locale qryLang, int startPointer, int docsRequested, java.util.Locale docLanguage, Attribute[] atts, java.lang.String terms, boolean withCount)
          Deprecated.  
 Result getResult(Query query, java.util.Locale qryLang, int startPointer, int docsRequested, java.util.Locale docLanguage, Attribute[] atts, java.lang.String terms, boolean withCount, boolean removeDuplicates)
          Deprecated.  
 Result getResult(Request request)
          Get the result for a search request.
 java.lang.String getTablePagePath()
          Gets the URL path of the web application (JSP or Servlet) that will render the contents of a table row cell.
 UserManager getUserManager()
          Gets the user manager used.
 java.lang.String getVersion()
          Return the product internal version from the Ultra Search Database.
 boolean isCloseConnection()
          Tests to see if connections are closed after each use.
 void setCloseConnection(boolean close)
          Control if the connections should be closed after each use.
 void setConnection(java.sql.Connection conn)
          Set the Connection used to connect to this instance.
 void setFilePagePath(java.lang.String str)
          Sets the URL path of the web application (JSP or Servlet) that will render the contents of a file row cell.
 void setInstanceName(java.lang.String inst)
          Set the instance name that should be used.
 void setMailPagePath(java.lang.String str)
          Sets the URL path of the web application (JSP or Servlet) that will render the contents of an email.
 void setRefreshInterval(int mins)
          Sets the interval by which the QueryInstance refresh groups, attributes, and LOVs from the database backend.
 void setTablePagePath(java.lang.String str)
          Sets the URL path of the web application (JSP or Servlet) that will render the contents of a table row cell.
 void setUserManager(UserManager newUserManager)
          Sets the user manager.
 void submitUrl(java.lang.String url)
          Submit an URL to be included in the instance.
 void submitUrlToDataSource(java.lang.String url, java.lang.String ds_name)
          Submit an URL to be included in a data source.
 void submitUrlToGroup(java.lang.String url, java.lang.String groupName)
          Submit an URL to be included in a group.

 

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

 

Constructor Detail

Instance

public Instance()
Construct an instance for searching.

Method Detail

setConnection

public void setConnection(java.sql.Connection conn)
Set the Connection used to connect to this instance.
Parameters:
conn - a JDBC 2.0 Connection object that is an OracleConnection.

setCloseConnection

public void setCloseConnection(boolean close)
Control if the connections should be closed after each use. Should be set to true for pooled connections, false for physical connections.
Parameters:
close - true for close after each use, false otherwise.

isCloseConnection

public boolean isCloseConnection()
Tests to see if connections are closed after each use.
Returns:
true if connections are closed after each use, false otherwise

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Get the Connection object used to connect to this instance. Subclasses can override this method to provide a different way of creating connections, such as using a connection pool data source.
Returns:
a Connection object
Throws:
java.sql.SQLException

setInstanceName

public void setInstanceName(java.lang.String inst)
Set the instance name that should be used. added to allow WKADMIN users to query on other instances. If the user owns exactly 1 instance, then there is no need to set this property, since the API will use that instance by default.
Parameters:
inst - the instance name, can be null if user has exactly 1 instance.

getInstanceName

public java.lang.String getInstanceName()
Get the instance name is used.
Returns:
the instance name, null if none is set (default).

setTablePagePath

public void setTablePagePath(java.lang.String str)
Sets the URL path of the web application (JSP or Servlet) that will render the contents of a table row cell.
Parameters:
str - a portion of a URL string representing the table rendering application.

getTablePagePath

public java.lang.String getTablePagePath()
Gets the URL path of the web application (JSP or Servlet) that will render the contents of a table row cell.
Returns:
a portion of a URL string representing the table rendering application.

setFilePagePath

public void setFilePagePath(java.lang.String str)
Sets the URL path of the web application (JSP or Servlet) that will render the contents of a file row cell.
Parameters:
str - a portion of a URL string representing the file rendering application.

getFilePagePath

public java.lang.String getFilePagePath()
Gets the URL path of the web application (JSP or Servlet) that will render the contents of a file.
Returns:
a portion of a URL string representing the file rendering application.

setMailPagePath

public void setMailPagePath(java.lang.String str)
Sets the URL path of the web application (JSP or Servlet) that will render the contents of an email.
Parameters:
str - a portion of a URL string representing the mail rendering application.

getMailPagePath

public java.lang.String getMailPagePath()
Gets the URL path of the web application (JSP or Servlet) that will render the contents of an email.
Returns:
a portion of a URL string representing the mail rendering application.

getUserManager

public UserManager getUserManager()
Gets the user manager used. The user manager is responsible for retrieving the J2EE user identity from the J2EE container. Different containers may require different implementations of UserManager.
Returns:
the new user manager being used

setUserManager

public void setUserManager(UserManager newUserManager)
Sets the user manager. The user manager is responsible for retrieving the J2EE user identity from the J2EE container. Different containers may require different implementations of UserManager.
Parameters:
newUserManager - the new user manager to use, not null

getVersion

public java.lang.String getVersion()
                            throws java.sql.SQLException
Return the product internal version from the Ultra Search Database. The following are examples of internal product version strings: "10.1.0", "9.0.4", "9.0.2", "9.2.0"
Returns:
internal version string
Throws:
java.sql.SQLException

getMetaData

public InstanceMetaData getMetaData()
                             throws java.sql.SQLException
Get the meta data associated with the query instance.
Returns:
an InstanceMetaData object
Throws:
java.sql.SQLException

estimateHitCount

public int estimateHitCount(Query query,
                            java.util.Locale qryLang,
                            java.util.Locale docLang)
                     throws java.sql.SQLException
Estimate the total number of hits for a query.
Parameters:
query - the query object, not null.
qryLang - the language of the query string, not null
docLang - the language of the document, use null to include documents of all languages.
Returns:
an estimate of total hit count >= 0
Throws:
java.sql.SQLException

getResult

public Result getResult(Request request)
                 throws java.sql.SQLException
Get the result for a search request.
Parameters:
request - the query request object, not null.
Returns:
a result object containing the documents for this query.
Throws:
java.sql.SQLException
Since:
10.1.0.2

getResult

public Result getResult(Query query,
                        java.util.Locale qryLang,
                        int startPointer,
                        int docsRequested,
                        java.util.Locale docLanguage,
                        Attribute[] atts,
                        java.lang.String terms,
                        boolean withCount)
                 throws java.sql.SQLException
Deprecated. 
Get the result for a query. Optionally, getResult can also perform an estimateHitCount() and store it in the Result object. This is more efficient than calling estimateHitCount() followed by getResult(). To use this feature, pass true for argument withCount.
Parameters:
query - the query object, not null.
qryLang - the language of the query string, not null
startPointer - The first document of the hit list to obtain. For example, specifying 3 means that the first two documents will be ignored.
docsRequested - The number of documents to be returned.
docLanguage - the document language, use null to include all languages.
atts - the document attributes to retrieve.
terms - the terms used to boost document scoring
withCount - whether to include the hit count estimate in the result
Returns:
a result object containing the documents for this query.
Throws:
java.sql.SQLException
Since:
9.0.2
See Also:
getResult(Request)

getResult

public Result getResult(Query query,
                        java.util.Locale qryLang,
                        int startPointer,
                        int docsRequested,
                        java.util.Locale docLanguage,
                        Attribute[] atts,
                        java.lang.String terms,
                        boolean withCount,
                        boolean removeDuplicates)
                 throws java.sql.SQLException
Deprecated. 
Get the result for a query. Optionally, getResult can also perform an estimateHitCount() and store it in the Result object. This is more efficient than calling estimateHitCount() followed by getResult(). To use this feature, pass true for argument withCount.
Parameters:
query - the query object, not null.
qryLang - the language of the query string, not null
startPointer - The first document of the hit list to obtain. For example, specifying 3 means that the first two documents will be ignored.
docsRequested - The number of documents to be returned.
docLanguage - the document language, use null to include all languages.
atts - the document attributes to retrieve.
terms - the terms used to boost document scoring
withCount - whether to include the hit count estimate in the result
removeDuplicates - whether to remove duplicates based on duplicate detection heuristic
Returns:
a result object containing the documents for this query.
Throws:
java.sql.SQLException
Since:
9.0.4
See Also:
getResult(Request)

submitUrl

public void submitUrl(java.lang.String url)
               throws SubmitURLException,
                      java.sql.SQLException
Submit an URL to be included in the instance.
Parameters:
url - the URL string.
Throws:
SubmitURLException
java.sql.SQLException

submitUrlToDataSource

public void submitUrlToDataSource(java.lang.String url,
                                  java.lang.String ds_name)
                           throws SubmitURLException,
                                  java.sql.SQLException
Submit an URL to be included in a data source.
Parameters:
url - the URL string.
Throws:
SubmitURLException
java.sql.SQLException

submitUrlToGroup

public void submitUrlToGroup(java.lang.String url,
                             java.lang.String groupName)
                      throws SubmitURLException,
                             java.sql.SQLException
Submit an URL to be included in a group.
Parameters:
url - the URL string.
Throws:
SubmitURLException
java.sql.SQLException

getRefreshInterval

public int getRefreshInterval()
Gets the interval by which meta data is refreshed.
Returns:
the interval in minutes. Value of 0 means caching is disabled.

setRefreshInterval

public void setRefreshInterval(int mins)
Sets the interval by which the QueryInstance refresh groups, attributes, and LOVs from the database backend.
Parameters:
mins - the interval in minutes. Value of 0 disables caching.

clearCache

public void clearCache()
Empty the meta-data cache, so the next call to getMetaData() will need to connect to the backend.

Skip navigation links

Oracle® Ultra Search Java API Reference
11g Release 1 (11.1)

B28329-02


Copyright © 2002,2008, Oracle. All Rights Reserved.