public abstract class SearchSpecification extends Object implements Serializable, Cloneable
Below is an example of how to do a simple content search, using a ContextSearchSpecification.
// specify sort order String [] ctxClauseName = {"Test1"}; // order by SCORE // set DESCENDING sort order boolean [] sortOrders = {false}; // SearchSortSpecification sortSpec = new SearchSortSpecification(new String[] {"DOCUMENT"}, new String[] {ContextQualification.ORDER_PREFIX + "." + ctxClauseName[0]}, sortOrders); // // create a query expression using interMedia Text query syntax String searchWord1 = "hierarchy"; String searchWord2 = "interfaces"; String queryOperator = " & "; String queryExpr = searchWord1 + queryOperator + searchWord2; // // create a ContextQualification and specify the query expression ContextQualification cq = new ContextQualification(); cq.setQuery( "?" ); cq.setName(ctxClauseName[0]); // // now join with CONTENTOBJECT JoinQualification jq = new JoinQualification(); jq.setLeftAttribute("DOCUMENT", "CONTENTOBJECT"); jq.setRightAttribute("CONTENTOBJECT", null); // SearchClause sc = new SearchClause( cq, jq, SearchClause.AND ); // ContextSearchSpecification cp = new ContextSearchSpecification(); cp.setContextClassname("CONTENTOBJECT"); cp.setSearchClassSpecification(new SearchClassSpecification(new String[] {"DOCUMENT", "CONTENTOBJECT"})); cp.setSearchQualification(sc); cp.setSearchSortSpecification(sortSpec); // Search s = new Search(sess, cp); // AttributeValue[] bindValue = new AttributeValue[1]; bindValue[0] = AttributeValue.newAttributeValue( queryExpr ); // s.open(bindValue); ... s.close();
AttributeSearchSpecification
,
ContextSearchSpecification
,
Search
,
SearchObject
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
CLEAR_PLAN_TABLE_PARAMETER
Parameter name for specifying whether rows from plan_table should be
cleared after explain plan.
|
protected boolean |
m_SecurityBindingInPlace
Security Clause parameters behavior.
|
static String |
PLAN_NAME_PARAMETER
Parameter name for specifying the plan name.
|
static String |
PLAN_TABLE_PARAMETER
Default Plan Table to use for explain Plan
|
static String |
SEARCH_ID_PARAMETER
Parameter name for id of Search Object.
|
static String |
SEARCH_SPEC_PARAMETER
Parameter name for Search Specification
|
Constructor and Description |
---|
SearchSpecification() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
bindValuesInPlace(oracle.ifs.search.BindValuesInSpecVisitor vis)
bindValuesInPlace- sets the bind Values in the SearchTree.
|
Object |
clone()
Returns a clone of this SearchQualification.
|
String[] |
contentClasses()
Return the list of classes on which the readAcces check must be performed.
|
void |
createView(S_LibrarySession sess,
ViewSpecification vsp)
Creates a database view based on this Specification, and the ViewSpecification.
|
String |
explainPlan(S_Search srchObj,
S_LibrarySession sess,
Hashtable planDetails)
Returns the Query Plan for the Search.
|
SearchSpecification |
getBoundSpecification(LibrarySession sess,
AttributeValue[] bindValues)
This Specification is cloned and the input bind Values are bound in place
in the cloned Specification.
|
Hashtable |
getContextScoreMap()
Returns a mapping from SCORE expression numbers to ContextQualifier names.
|
abstract String[] |
getResultClasses()
Returns all Result Classes
|
abstract SearchClassSpecification |
getSearchClassSpecification()
Returns the SearchClassSpecification associated with this SearchSpecification.
|
Enumeration |
getSQL(S_Search srchObj,
S_LibrarySession s)
Returns the SQL for this Specification.
|
Enumeration |
getSQL(S_Search srchObj,
S_LibrarySession s,
Vector avs,
boolean searchCountOnly)
Returns the SQL for this Specification.
|
protected abstract Enumeration |
getSQL(String prefix,
S_Search srchObj,
S_LibrarySession sess,
Vector avs,
boolean searchCountOnly)
Returns the SQL for this Specification.
|
abstract String |
getSQLString(String prefix,
S_LibrarySession session,
boolean searchCountOnly)
Returns the SQL string for this SearchSpecification.
|
protected abstract String |
getViewStatement(ViewSpecification vsp,
S_LibrarySession sess)
Generates a View creation statement, based on the ViewSpecification.
|
abstract void |
validate(LibrarySession s)
This function validates the Specification in a LibrarySession.
|
public static final String PLAN_TABLE_PARAMETER
public static final String PLAN_NAME_PARAMETER
public static final String CLEAR_PLAN_TABLE_PARAMETER
public static final String SEARCH_ID_PARAMETER
public static final String SEARCH_SPEC_PARAMETER
protected boolean m_SecurityBindingInPlace
public abstract void validate(LibrarySession s) throws IfsException
s
- LibrarySession to use for validating Search elements.IfsException
- if validation failsSearchValidator
public Enumeration getSQL(S_Search srchObj, S_LibrarySession s) throws IfsException
srchObj
- server-side Search Objects
- server-side sessionIfsException
- if sql generation failsgetSQL(String, S_Search, S_LibrarySession, Vector, boolean)
public Enumeration getSQL(S_Search srchObj, S_LibrarySession s, Vector avs, boolean searchCountOnly) throws IfsException
srchObj
- server-side Search Objects
- server-side sessionavs
- list of bind ValuesIfsException
- if sql generation failsgetSQL(String, S_Search, S_LibrarySession, Vector, boolean)
protected abstract Enumeration getSQL(String prefix, S_Search srchObj, S_LibrarySession sess, Vector avs, boolean searchCountOnly) throws IfsException
prefix
- sql generated is prefixed with this String. Used during explain plan.srchObj
- server-side Search Objectsess
- server-side sessionavs
- list of bind ValuessearchCountOnly
- IfsException
- if sql generation failsgetSQL(String, S_Search, S_LibrarySession, Vector, boolean)
public abstract String getSQLString(String prefix, S_LibrarySession session, boolean searchCountOnly) throws IfsException
prefix
- sql generated is prefixed with this String. Used during explain plan.session
- server-side sessionsearchCountOnly
- if true, it generates a count(*) in select.IfsException
- if the operation fails.public String explainPlan(S_Search srchObj, S_LibrarySession sess, Hashtable planDetails) throws IfsException
select lpad(' ', 2*level) || operation || ':' || options || ' ' ||
object_name || ':' || object_instance || ':' || object_type || ' ' ||
'(' || cost || ', ' || cardinality || ', ' || bytes ') ' ||
'(' || partition_start || ', ' || partition_stop || ', ' || partition_id ')'
from PLAN_TABLE
where statement_id = PLANNAME
start with id = 1 connect by prior id = parent_id
srchObj
- Associated SearchObjectsess
- LibrarySessionplanDetails
- Hashtable containing Plan parameters.IfsException
- if operation fails.protected abstract String getViewStatement(ViewSpecification vsp, S_LibrarySession sess) throws IfsException
vsp
- details about the View for which the creation statement is to be
generated.sess
- server-side session.IfsException
- if operation fails.public void createView(S_LibrarySession sess, ViewSpecification vsp) throws IfsException
sess
- server-side session.vsp
- view detailsIfsException
- if operation failspublic abstract String[] getResultClasses() throws IfsException
IfsException
public abstract SearchClassSpecification getSearchClassSpecification() throws IfsException
IfsException
- if the operation failspublic Hashtable getContextScoreMap() throws IfsException
IfsException
- if operation fails.public String[] contentClasses() throws IfsException
IfsException
- if operation fails.public SearchSpecification getBoundSpecification(LibrarySession sess, AttributeValue[] bindValues) throws IfsException
sess
- session used for binding valuesbindValues
- bind Values for SearchTreeIfsException
- if operation fails.protected abstract void bindValuesInPlace(oracle.ifs.search.BindValuesInSpecVisitor vis) throws IfsException
vis
- BindValues VisitorIfsException
- if operation fails.Copyright © 2023. All rights reserved.