|
Oracle Ultra Search APIs 9.0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.context.isearch.query.QueryTool
This class implements the Ultra Search Java Query API.
It defines all constants and methods that facilitate querying an Ultra Search instance index.
The methods implemented by this API can be classified as follows:
These methods return data from the Ultra Search instance such as data group information, query attribute information and query result data. The addUrl method adds data into the Ultra Search instance.
The methods that fall under this class are as follows:
Methods that return HTML code or are related to the presentation of HTML code
These methods perform the following tasks:
The methods that fall under this class are as follows:
Ultra Search database session methods
These methods are related to the jdbc database session. They include setting the username, password and session language.
The methods that fall under this class are as follows:
Utility methods
These methods exist as convenience method for the client web application developer. They encapsulate commonly performed tasks.
The methods that fall under this class are as follows:
Field Summary | |
static int |
ADD_URL_DISABLED A constant that defines one of the eight return values of the addUrl method signifying that the add seed URL feature has been disabled by the Ultra Search Administrator. |
static int |
ADD_URL_DUPLICATE_URL A constant that defines one of the eight return values of the addUrl method signifying that the user has attempted to add a seed URL that has already exists for the target web source |
static int |
ADD_URL_INCORRECT_SOURCE_TYPE A constant that defines one of the eight return values of the addUrl method signifying that an attempt was made to add the seed URL to a data source other than a web data source. |
static int |
ADD_URL_INTERNAL_ERROR A constant that defines one of the eight return values of the addUrl method signifying that an internal error occurred during the attempt to add a seed URL to a web data source. |
static int |
ADD_URL_INVALID_URL A constant that defines one of the eight return values of the addUrl method signifying that an attempt was made to add an invalid seed URL to a web data source. |
static int |
ADD_URL_NO_WEBDS A constant that defines one of the eight return values of the addUrl method signifying that there was no appropriate web data source to add the seed URL to. |
static int |
ADD_URL_OK A constant that defines one of the eight return values of the addUrl method signifying that the addition of the URL to the seed URL list completed successfully. |
static int |
ADD_URL_OUT_OF_SCOPE A constant that defines one of the eight return values of the addUrl method signifying that an was made to add a seed URL outside the URL scope of a web data source. |
static int |
EMAIL_DATA_SOURCE A constant that defines the email data source type |
static int |
FILE_DATA_SOURCE A constant that defines the file data source type |
static int |
TABLE_DATA_SOURCE A constant that defines the table data source type |
static int |
WEB_DATA_SOURCE A constant that defines the web data source type |
Constructor Summary | |
QueryTool() Default constructor |
Method Summary | |
int |
addUrl(java.lang.String url) Use this method to add a URL to the seed URL list of all web sources. |
int |
addUrltoGroup(java.lang.String url, java.lang.String groupName) Use this method to add a URL to the seed URL list of all web sources belonging to a data group. |
int |
addUrltoSource(java.lang.String url, java.lang.String sourceName) Use this method to add a URL to the seed URL list of a specific web sources. |
java.lang.String |
createPageLinks(java.lang.String query, int currentPage, int hitCount, QueryAttribute[] queryAttributes, Item[] groups, java.lang.String language, java.lang.String resultTarget) Use this method to create the result page links that appear at the bottom of the screen under the result list. |
java.lang.String |
createQueryForm(java.lang.String action, java.lang.String query, QueryAttribute[] queryAttr, java.lang.String language, java.lang.String[] group, Item[] attrChoices, Item[] langChoices, Item[] groupChoices, java.lang.String queryTarget, java.lang.String resultTarget) Creates the HTML form for the query input. |
java.lang.String |
createResultTable(java.lang.String query, int page, QueryAttribute[] queryAttributes, Item[] groups, java.lang.String language) Use this method to create an HTML table of the query result. |
void |
displayFileUrl(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) Call this method to display the contents of a file data source document. |
void |
displayTableUrl(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) Call this method to display the contents of a table data source (database row cell). |
int |
estimateHitCount(java.lang.String query, QueryAttribute[] queryAttributes, Item[] groups, java.lang.String language) Gets an estimate count of hits that satisfy a query and its criteria. |
java.lang.String |
getAddMoreAttrButton() Gets the text for the label that invites the end-user to add more search attributes to the query. |
java.lang.String |
getAndOperator() Gets the text for the label that signifies the AND logical operator. |
java.lang.String |
getAnyLanguageLabel() Gets the text for the label that indicates that a query should search documents in all languages. |
Item[] |
getAttributes() Gets the list of Query Attributes that are defined in the Oracle Ultra Search instance. |
java.lang.String |
getAuthorFormat() Gets the text for the document author format string on the result page. |
java.lang.String |
getDataGroupFormat() Gets the data group score format string that deterimes how the data group is to be presented on each hit row. |
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 |
getFromLabel() Sets the text for the label that indicates that a query is to be restricted to certain data groups. |
Item[] |
getGroups() Gets the list of Data Groups that are defined in the Oracle Ultra Search instance. |
int |
getHitsPerPage() Gets the number of hits to display per page. |
java.lang.String |
getLanguageLabel() Gets the text for the label that indicates that a query is to be restricted to a certain language. |
Item[] |
getLanguages() Gets the list of languages that Oracle Ultra Search understands. |
java.lang.String |
getLastModifiedFormat() Gets the text for the label last-modified date format string on the result page. |
java.lang.String |
getMailPagePath() Gets the URL path of the web application (JSP or Servlet) that will render the contents of an email. |
int |
getMaxPageNum() Gets the maximum page number that the getResult method returns. |
java.lang.String |
getNarrowedByLabel() Gets the text for the label that indicates a query is to be narrowed by certain criteria. |
java.lang.String |
getNoTitleString() Gets the text to show in place of the title of a document when a document does not have a title. |
java.lang.String |
getOrOperator() Gets the text for the label that signifies the OR logical operator. |
java.lang.String |
getPageCharset() Gets the character set of the Query Application. |
int |
getPageLinks() Gets the number of result page links. |
java.lang.String |
getPageSizeFormat() Gets the page size format string on result page. |
java.lang.String |
getParameter(javax.servlet.ServletRequest request, java.lang.String pname) Gets a parameter value from the incoming servlet request in the "iso-8859-1" character set. |
java.lang.String[] |
getParameterValues(javax.servlet.ServletRequest request, java.lang.String pname) Gets the parameter values from the incoming servlet request in the "iso-8859-1" character set. |
static java.lang.String |
getPlsqlVersion() |
java.lang.String |
getQueryPagePath() Gets the query page path. |
static java.lang.String |
getQueryVersion() |
java.lang.String |
getResourceFileName() Gets the name of the .properties file that contains the database resource settings. |
Document[] |
getResult(java.lang.String query, int startPointer, int recordsRequested, QueryAttribute[] queryAttributes, Item[] groups, java.lang.String language) Gets the query result based on certain query criteria. |
java.lang.String |
getScoreFormat() Gets the document relevance score format string. |
java.lang.String |
getSearchButton() Gets the text for the "Search" button label. |
java.lang.String |
getSearchForLabel() Gets the text for the "Search for" label on query form. |
java.lang.String |
getSessionLang() Gets the session language for the database SQL session. |
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. |
java.lang.String |
getUser() Gets the database username of the Ultra Search instance that should be accessed. |
java.lang.String |
htmlEncode(java.lang.String str) Convenience method for converting certain characters into HTML encoding. |
boolean |
isVersionCompatible() |
void |
setAddMoreAttrButton(java.lang.String str) The text for the label that invites the end-user to add more search attributes to the query. |
void |
setAndOperator(java.lang.String str) Sets the text for the label that signifies the AND logical operator. |
void |
setAnyLanguageLabel(java.lang.String str) Sets the text for the label that indicates that a query should search documents in all languages. |
void |
setAuthorFormat(java.lang.String str) Sets the document author format string on the result page. |
void |
setDataGroupFormat(java.lang.String str) Sets the data group format string. |
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 |
setFromLabel(java.lang.String str) Gets the text for the label that indicates that a query is to be restricted to certain data groups. |
void |
setHitsPerPage(int n) Sets the number of hits to display per page. |
void |
setLanguageLabel(java.lang.String str) Sets the text for the label that indicates that a query is to be restricted to a certain language. |
void |
setLastModifiedFormat(java.lang.String str) Gets the last-modified date format string on the result page. |
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 |
setMaxPageNum(int n) Sets the maximum page number that the getResult method returns. |
void |
setNarrowedByLabel(java.lang.String str) Sets the text for the label that indicates a query is to be narrowed by certain criteria. |
void |
setNoTitleString(java.lang.String str) Sets the text to show in place of the title of a document when a document does not have a title |
void |
setOrOperator(java.lang.String str) Sets the text for the label that signifies the OR logical operator. |
void |
setPageCharset(java.lang.String str) Sets the character set of the Query Application. |
void |
setPageLinks(int n) Sets the number of result page links at the bottom of a search result page. |
void |
setPageSizeFormat(java.lang.String str) Sets the page size format string on result page. |
void |
setPassword(java.lang.String str) Sets the database username password of the Ultra Search instance that should be accessed. |
void |
setQueryPagePath(java.lang.String str) Sets the URL path to the JSP Query Application. |
void |
setResourceFileName(java.lang.String str) Sets the name of the .properties file that contains the database resource settings. |
void |
setScoreFormat(java.lang.String str) Sets the document relevance score format string. |
void |
setSearchButton(java.lang.String str) Sets the text for the "Search" button label. |
void |
setSearchForLabel(java.lang.String str) Gets the text for the "Search for" label on query form. |
void |
setSessionLang(java.lang.String str) Sets the session language for database SQL session. |
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 |
setUser(java.lang.String str) Sets the database username of the Ultra Search instance that should be accessed. |
java.lang.String |
urlEncode(java.lang.String str) Convenience method for returning a string in the "x-www-form-urlencoded" format. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ADD_URL_OK
public static final int ADD_URL_NO_WEBDS
public static final int ADD_URL_INVALID_URL
public static final int ADD_URL_DISABLED
public static final int ADD_URL_DUPLICATE_URL
public static final int ADD_URL_INCORRECT_SOURCE_TYPE
public static final int ADD_URL_OUT_OF_SCOPE
public static final int ADD_URL_INTERNAL_ERROR
public static final int WEB_DATA_SOURCE
public static final int FILE_DATA_SOURCE
public static final int TABLE_DATA_SOURCE
public static final int EMAIL_DATA_SOURCE
Constructor Detail |
public QueryTool()
Method Detail |
public void setMailPagePath(java.lang.String str)
str
- a portion of a URL string representing the mail rendering application.public java.lang.String getMailPagePath()
public void setResourceFileName(java.lang.String str) throws java.sql.SQLException
str
- the database resource filenamepublic java.lang.String getResourceFileName()
public void setUser(java.lang.String str)
str
- This must be an Oracle database username.public java.lang.String getUser()
public void setPassword(java.lang.String str)
str
- This must be an Oracle database username password.public void setQueryPagePath(java.lang.String str)
For example, setting Query Page Path to '/ultrasearch/query/jsp/gsearch.jsp' implies that end-users will access the Sample JSP Query Application via the URL http://host:port/ultrasearch/query/jsp/gsearch.jsp
str
- The query page pathpublic java.lang.String getQueryPagePath()
public void setTablePagePath(java.lang.String str)
str
- a portion of a URL string representing the table rendering application.public java.lang.String getTablePagePath()
public void setFilePagePath(java.lang.String str)
str
- a portion of a URL string representing the file rendering application.public java.lang.String getFilePagePath()
public void setSessionLang(java.lang.String str)
The session language determines how Oracle Text choose a lexer to interpret the query string.
The session language is a string that the Oracle Server understands. This list can be found in the Oracle National Language Support Guide. The languages returned by the getLanguages method are not exactly the same as that which are needed by the Oracle Server. Do not use the languages returned by the getLanguages method.
str
- Theh Oracle Server compatible language string.public java.lang.String getSessionLang()
public void setPageCharset(java.lang.String str)
This QueryTool class which runs in the middle-tier needs to know the character set used by the JSP page (that you, the customer are free to define). The reasons why the QueryTool class needs to know the character set include the following:
str
- Specify an official IANA Registered character set. An example is "iso-2022-jp-2" or the common "iso-8859-1".public java.lang.String getPageCharset()
public void setMaxPageNum(int n)
n
- the maximum page number of the page links int a query result page.public int getMaxPageNum()
public void setHitsPerPage(int n)
n
- an integer denoting the number of hits to display per pagepublic int getHitsPerPage()
public void setPageLinks(int n)
n
- an integer denoting the number of page links.public int getPageLinks()
public void setSearchForLabel(java.lang.String str)
str
- The text for the label.public java.lang.String getSearchForLabel()
public void setNoTitleString(java.lang.String str)
str
- The text to show when there is no titlepublic java.lang.String getNoTitleString()
public void setSearchButton(java.lang.String str)
str
- The text for the label.public java.lang.String getSearchButton()
public void setNarrowedByLabel(java.lang.String str)
str
- The text for the label.public java.lang.String getNarrowedByLabel()
public void setFromLabel(java.lang.String str)
str
- The text for the label.public java.lang.String getFromLabel()
public void setLanguageLabel(java.lang.String str)
str
- The text for the label.public java.lang.String getLanguageLabel()
public void setAnyLanguageLabel(java.lang.String str)
str
- The text for the label.public java.lang.String getAnyLanguageLabel()
public void setAddMoreAttrButton(java.lang.String str)
str
- The text for the label.public java.lang.String getAddMoreAttrButton()
public void setAndOperator(java.lang.String str)
str
- The text for the label.public java.lang.String getAndOperator()
public void setOrOperator(java.lang.String str)
str
- The text for the label.public java.lang.String getOrOperator()
public void setAuthorFormat(java.lang.String str)
str
- The text for the document author format string.public java.lang.String getAuthorFormat()
public void setLastModifiedFormat(java.lang.String str)
str
- The text for the last-modified date format string.public java.lang.String getLastModifiedFormat()
public void setPageSizeFormat(java.lang.String str)
str
- The page size format string.public java.lang.String getPageSizeFormat()
public void setDataGroupFormat(java.lang.String str)
str
- The data group format string.public java.lang.String getDataGroupFormat()
public void setScoreFormat(java.lang.String str)
str
- The document relevance score format string.public java.lang.String getScoreFormat()
public java.lang.String getParameter(javax.servlet.ServletRequest request, java.lang.String pname) throws java.io.UnsupportedEncodingException
Browsers can send text encoded in various character sets. However, the JSP engine always interprets it in the "iso-8859-1" character set. Therefore, the JSP or Servlet web application always needs to convert the incoming parameters into the "iso-8859-1" character set.
This method is supplied as a convenience utility method that can be called by your JSP or Servlet web application.
request
- The incoming Servlet requestpname
- The parameter namepublic java.lang.String[] getParameterValues(javax.servlet.ServletRequest request, java.lang.String pname) throws java.io.UnsupportedEncodingException
Browsers can send text encoded in various character sets. However, the JSP engine always interprets it in the "iso-8859-1" character set. Therefore, the JSP or Servlet web application always needs to convert the incoming parameters into the "iso-8859-1" character set. This method is supplied as a convenience utility method that can be called by your JSP or Servlet web application.
request
- The incoming Servlet requestpnamem
- The parameter namepublic Item[] getLanguages() throws java.sql.SQLException
The languages returned by this method are not exactly the same as those needed by the getSessionLang method.
This method is especially useful for displaying a list of easily-readable languages to the end-user. Typically, this list is displayed to the end-user who selects a language to search in.
public Item[] getGroups() throws java.sql.SQLException
The Data Groups are defined via the Administration Tool.
public Item[] getAttributes() throws java.sql.SQLException
The Query Attributes are defined via the Administration Tool.
public Document[] getResult(java.lang.String query, int startPointer, int recordsRequested, QueryAttribute[] queryAttributes, Item[] groups, java.lang.String language) throws java.io.UnsupportedEncodingException, java.sql.SQLException
The input arguments specify the criteria for this query. They include the query attributes, data groups to search in and the language to restrict the search to.
The startPointer and recordsRequested parameters are used to determine which records to return.
A note about the queryAttributes argument:
queryAttributes is an array of QueryAttribute objects that represent query attributes which the documents returned by the query must comply to.
For example, the following settings specify documents which contain 'Oracle' in the Title attribute and 'John' in the Author attribute:
queryAttributes[1].id = 45; // fictional id of 'Title' attribute
queryAttributes[1].query = 'Oracle'; // the value of the 'Title' attribute
queryAttributes[1].operator = 'And'; //
queryAttributes[2].id = 46; // fictional id of 'Author' attribute
queryAttributes[2].query = 'John'; // the value of the 'Author' attribute
queryAttributes[2].operator = 'And'; //
query
- The query string.startPointer
- The first document of the hit list to obtain. For example, specifying 3 means that the first two documents will be ignored.recordsRequested
- The number of documents to be returned.queryAttributes
- An array of QueryAttribute objects.groups
- An array of Item objects where each Item object encapsulates information identifying a Data Group which the user wants to restrict the search to.language
- The language of the documents that should be searched.public int estimateHitCount(java.lang.String query, QueryAttribute[] queryAttributes, Item[] groups, java.lang.String language) throws java.sql.SQLException
query
- The query string.queryAttributes
- An array of QueryAttribute objects where each object represents a query attribute that the documents returned by the query must comply to.groups
- An array of Item objects where each Item object encapsulates information identifying a Data Group which the user wants to restrict the search to.language
- The language of the documents that should be searched.public java.lang.String createQueryForm(java.lang.String action, java.lang.String query, QueryAttribute[] queryAttr, java.lang.String language, java.lang.String[] group, Item[] attrChoices, Item[] langChoices, Item[] groupChoices, java.lang.String queryTarget, java.lang.String resultTarget)
There are two possible actions that can be specified. These are determined by the values of the contants SEARCH_BUTTON and ADD_MORE_ATTR_BUTTON.
If the action parameter value is equal to the SEARCH_BUTTON constant, this causes the query application to perform a query.
If it is equal to the ADD_MORE_ATTR_BUTTON constant, the query application to redraws the form with one more attribute line that enables the end-user to add another attribute requirement.
action
- The action form parameter value.query
- The query string to display. Defaults to an empty string.queryAttr
- An array of QueryAttribute objects where each object represents a query attribute setting to display in the HTML form.language
- The language of the documents that should be selected in the HTML form.groups
- An array of Item objects where each Item object encapsulates information identifying a Data Group which should be selected in the HTML form.attrChoices
- An array of Item objects that specifies the attribute list that the query form displays to the end-user.langChoices
- An array of Item objects that specifies the language list that the query form displays to the end-user.groupChoices
- An array of Item objects that specifies the group list that the query form displays to the end-user.queryTarget
- The query form target frame name. This parameter is used when there is a specific HTML frame where the query form should be placed in.resultTarget
- The query result target frame. This parameter is used when there is a specific HTML frame where the query result text should be placed in. It causes the HTML anchor tags to specify the target attribute as the resultTarget frame.public java.lang.String createResultTable(java.lang.String query, int page, QueryAttribute[] queryAttributes, Item[] groups, java.lang.String language) throws java.io.UnsupportedEncodingException, java.sql.SQLException
query
- The query string.page
- Specifies which result page to create HTML for. Different pages contain different hit results. The number of hits per page is controlled via the setHitsPerPage and getHitsPerPage methods.queryAttributes
- An array of QueryAttribute objects where each object represents a query attribute that the documents returned by the query must comply to.groups
- An array of Item objects where each Item object encapsulates information identifying a Data Group which the user wants to restrict the search to.language
- The language of the documents that should be searched.public java.lang.String urlEncode(java.lang.String str) throws java.io.UnsupportedEncodingException
The
- input string to convert.public java.lang.String htmlEncode(java.lang.String str)
This method analyzes the input string and performs the following conversions:
str
- The input string to convert.public java.lang.String createPageLinks(java.lang.String query, int currentPage, int hitCount, QueryAttribute[] queryAttributes, Item[] groups, java.lang.String language, java.lang.String resultTarget) throws java.io.UnsupportedEncodingException, java.sql.SQLException
The hitcount is used to calculate the number of page links to display. The number of page links is the hitCount divided by the number of hits per page or the max page number, whichever is smaller.
If the hitCount is set to 0, this method will attempt to calculate the hitCount account to the query criteria - which means it will take longer to return.
query
- The query string.currentPage
- The current page number.hitCount
- The estimated hit count for this query.queryAttributes
- An array of QueryAttribute objects where each object represents a query attribute which was specified in the search. Query attribute information is used to when calculating the hitCount and also in forming the URLs to other pages.groups
- An array of Item objects where each Item object encapsulates information identifying a Data Group which the user specified in the search. Data Group information is used to when calculating the hitCount and also in forming the URLs to other pages.language
- The language of the documents that was searched. language information is used to when calculating the hitCount and also in forming the URLs to other pages.resultTarget
- The query result target frame. This parameter is used when there is a specific HTML frame where the query result text should be placed in. It causes the HTML anchor tags to specify the target attribute as the resultTarget frame.public int addUrl(java.lang.String url) throws java.sql.SQLException
The return value is a string constant of one of the following 8 values:
url
- The URL to add to the seed URL list for web crawling.public int addUrltoSource(java.lang.String url, java.lang.String sourceName) throws java.sql.SQLException
url
- The URL to add to the seed URL list for web crawling.sourceName
- The name of the web data source to add the seed URL to.public int addUrltoGroup(java.lang.String url, java.lang.String groupName) throws java.sql.SQLException
url
- The URL to add to the seed URL list for web crawling.groupName
- The name of the web data group containing specific web sources to add the seed URL to.public void displayTableUrl(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws java.io.IOException, java.sql.SQLException
This method makes a database call which returns the contents the database row cell. The table may reside on a separate database which must be accessible by the Ultra Search database via a database link.
request
- The incoming Servlet request object containing all request data.response
- The outgoing Servlet response object whose PrintWriter this method will print text to.public static java.lang.String getPlsqlVersion()
public static java.lang.String getQueryVersion()
public boolean isVersionCompatible() throws java.sql.SQLException
public void displayFileUrl(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws java.io.IOException, java.sql.SQLException
This method makes a database call which returns the contents of the file. Therefore, the file must be accessible by the database server.
request
- The incoming Servlet request object containing all request data.response
- The outgoing Servlet response object whose PrintWriter this method will print text to.
|
Oracle Ultra Search APIs 9.0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |