|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.portal.search.demo.Search | +--com.sun.portal.search.providers.SearchContext
This class provides convenient methods to handle advanced search and
also evolved from the frontend application requirements.
Search
Field Summary | |
static String |
ALL
corresponds to <ALL> string operation |
static String |
ANY
corresponds to <OR> operation |
static String |
CONTAIN
corresponds to <CONTAINS> operation |
static String |
EQUAL
corresponds to '=' operation used to compare number type |
static String |
EXACT
corresponds to <EXACT> string operation |
static String |
GREATER
corresponds to '>' operation used to compare number type |
static String |
LESS
corresponds to '<' operation used to compare number type |
static String |
NOT
corresponds to <NOT> operation |
static String |
NOTCONTAIN
corresponds to <NOT> <CONTAINS> operation |
static String |
NOTEQUAL
corresponds to 'not equal to' operation used to compare number type |
static String |
OPERAND
|
static String |
OPERATION
The operation in a list element |
static String |
PASSAGE
corresponds to <PASSAGE> string operation |
static String |
VALUE
The right operand in a list element |
Constructor Summary | |
SearchContext()
Public Constructor calls super() |
Method Summary | |
void |
execute()
Executes the query |
String |
getCategory()
Gets the value of category |
int |
getPage()
Gets the current page value |
int |
getTotalPages()
Gets the total pages |
static String |
htmlEncode(String s)
Encodes > <, ", & characters |
void |
setCategory(String bc)
Sets the category value. |
void |
setPage(int p)
Sets the current page value. |
void |
setScope(ArrayList c)
Sets the list of criteria for the scope. |
void |
setSearchAllCategories(boolean all)
Sets the searchAllCategories property. |
Methods inherited from class com.sun.portal.search.demo.Search |
doQuery, doQuery, getDocumentCount, getFirstHit, getHitCount, getQuery, getQueryLanguage, getRDMHeaderSOIF, getRDMServer, getRDMType, getResultCount, getResultStream, getScope, getSessionID, getStringResult, getToHit, getViewAttributes, getViewHits, getViewOrder, noHits, setDatabase, setFirstHit, setQueryLanguage, setRDMServer, setRDMType, setScope, setSessionID, setSOIFParse, setStreamMode, setViewAttributes, setViewHits, setViewOrder, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String OPERAND
public static final String OPERATION
public static final String VALUE
public static final String CONTAIN
public static final String NOTCONTAIN
public static final String NOT
public static final String ANY
public static final String EXACT
public static final String ALL
public static final String PASSAGE
public static final String GREATER
public static final String LESS
public static final String EQUAL
public static final String NOTEQUAL
Constructor Detail |
public SearchContext()
Method Detail |
public void setPage(int p)
firstHit for searches is calculated based on the current page and viewHits.
page
- is the current page valuepublic int getPage()
public String getCategory()
The category value is used to create the scope value in the
execute()
method.
The scope and the category are combined together based
on the type of request. taxonomy-request v/s rd-request
setSearchAllCategories(boolean)
public void setCategory(String bc)
category setting is mainly required if category search is needed.
bc
- is the current category level, If the category is not set
then the category is set to the root of the taxonomy tree and the search
is executed for all categories.getCategory()
,
setSearchAllCategories(boolean)
public void setSearchAllCategories(boolean all)
This property value is used in the execute()
to create the scope
all
- true implies that search should be in all the cateogories
and false means that search should be within a specific categorypublic void setScope(ArrayList c)
Advanced search related methods.The list should have specific operands, operations and values. The list is then internally converted to a String query as per the search engine query language.
c
- criteria list for the search querypublic void execute() throws Exception
Calls the parent doQuery()
method after doing some preprocessing to the
query string. Merges category, searchAllCategories, scope string into a final scope
string.
Exception
- is thrown if any of the input parameters are not specified or if
the resultset is null or if connection to the search server failedpublic int getTotalPages()
Calculated based on the hitCount and viewHits.
totalPages has no value if called before calling
execute()
first
public static String htmlEncode(String s)
s
- string that needs to be html encoded
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |