| java.lang.Object soif.Search
Search | public class Search (Code) | | Search encapsulation class.
|
Field Summary | |
final public static int | ABEND Processing status: completed abnormally. | final public static int | COMPLETE Processing status: completed successfully. | final public static int | EMPTY Processing status: empty instance. | final public static int | PREPARED Processing status: initial state uponb construction. | final public static int | PROCESSING Processing status: search in progress. |
Constructor Summary | |
public | Search() Constructor. | public | Search(String scope, String RDMServer) Constructor.
Default values implicit in this constructor are:
- viewAttributes: null. | public | Search(String scope, String viewAttributes, String viewOrder, int firstHit, int viewHits, String ql, CSID csid, String RDMServer) Constructor. | public | Search(String scope, String viewAttributes, String viewOrder, String ql, CSID csid, String RDMServer) Constructor. | public | Search(String scope, String viewAttributes, String viewOrder, int viewHits, String ql, CSID csid, String RDMServer) |
Method Summary | |
public void | doQuery() Execute the query. | public void | doQuery(int firstHit, int viewHits) Execute the query, returning viewHits hits starting at firstHit. | public int | documentCount() The total number of documents available to be searched. | final public boolean | finished() Return whether or not processing is complete. | public int | getDocumentCount() The total number of documents available to be searched. | public int | getFirstHit() Get the starting hit offset. | public int | getHitCount() The total number of results that matched the search. | public String | getQuery() Return the fully formatted query url sent to the server. | public String | getQueryLanguage() Returns the current query language. | public SOIF | getRDMHeaderSOIF() Return the SOIF RDM result header. | public String | getRDMServer() Returns the current RDMServer variable. | public String | getRDMType() Returns the current RDMType. | public int | getResultCount() The number of results returned by the search. | public DataInputStream | getResultStream() Return results as a DataInputStream. | public SOIF | getSOIFResult() Return SOIF version of result. | public String | getScope() Returns the current scope (query) for the search. | final public int | getStatus() Return processing status. | public String | getStringResult() Return result. | public String | getViewAttributes() | public int | getViewHits() Get the maximum number of hits returned. | public String | getViewOrder() Gets the sorting order for results.
Parameters: strVal - A null string will return sorting according tothe server default of -score (descending relevance). | public int | hitCount() The total number of results that matched the search. | final public boolean | isFinished() Return whether or not processing is complete. | public int | resultCount() The number of results returned by this search. | public void | setFirstHit(int firstHit) Set the starting hit offset. | public void | setQueryLanguage(String ql) Sets the query language.
Parameters: ql - Can be one of:- compass: The default Compass query language.
| public void | setRDMServer(String RDMServer) Sets the RDMServer variable. | public void | setRDMType(String RDMType) Sets the RDM Request type.
Parameters: RDMType - Can be one of:- rd-request: The default request.
| public void | setSOIFParse(boolean b) Set whether SOIF parsing is to be done or not. | public void | setScope(String scope) Sets the scope (query) for the search. | public void | setStreamMode(boolean m) Sets whether streaming is enabled or disabled.
By default, this is set to false.
When stream mode is enabled, the search results
RDM header SOIF will still be parsed, so that
result, hit and document counts are available, but
the document hit data will not be parsed. | public void | setViewAttributes(String viewAttributes) Sets the SOIF attributes which are returned for the search. | public void | setViewHits(int viewHits) Set the maximum number of hits returned. | public void | setViewOrder(String viewOrder) Sets the sorting order for results.
Parameters: viewOrder - A null string will return sorting according tothe server default of -score (descending relevance). | public String | toString() Return debug string version of Search instance. |
ABEND | final public static int ABEND(Code) | | Processing status: completed abnormally.
|
COMPLETE | final public static int COMPLETE(Code) | | Processing status: completed successfully.
|
EMPTY | final public static int EMPTY(Code) | | Processing status: empty instance.
|
PREPARED | final public static int PREPARED(Code) | | Processing status: initial state uponb construction.
|
PROCESSING | final public static int PROCESSING(Code) | | Processing status: search in progress.
|
Search | public Search()(Code) | | Constructor.
|
Search | public Search(String scope, String RDMServer)(Code) | | Constructor.
Default values implicit in this constructor are:
- viewAttributes: null. Return all attributes
- viewOrder: null. Return server default (ie, sorted by relevance)
- firsthit: 1. Start hits at hit number 1
- viewhits: 10. Return 10 hits only
- query language: compass. Search documents
- csid: null. Use the default csid for the server
Parameters: scope - the query qualification Parameters: RDMServer - Compass server URL, eg, http://compass.mycompany.com:2222/ since: 3.01C |
Search | public Search(String scope, String viewAttributes, String viewOrder, int firstHit, int viewHits, String ql, CSID csid, String RDMServer)(Code) | | Constructor.
Parameters: scope - the query qualification Parameters: viewAttributes - comma delimited desired result attributes Parameters: viewOrder - comma delimited sort order w/ +ascend and -descend Parameters: viewHits - maximum number of results requested Parameters: ql - query language Parameters: csid - Compass Server ID (can be null for server's default csid) Parameters: RDMServer - Compass Server URL |
Search | public Search(String scope, String viewAttributes, String viewOrder, String ql, CSID csid, String RDMServer)(Code) | | Constructor.
Parameters: scope - the query qualification Parameters: viewAttributes - comma delimited desired result attributes Parameters: viewOrder - comma delimited sort order w/ +ascend and -descend Parameters: ql - query language Parameters: csid - Compass Server ID (can be null for server's default csid) Parameters: RDMServer - Compass server URL, eg, http://compass/Search.Search() |
Search | public Search(String scope, String viewAttributes, String viewOrder, int viewHits, String ql, CSID csid, String RDMServer)(Code) | | Search.Search() Parameters: scope - the query qualification Parameters: viewAttributes - comma delimited desired result attributes Parameters: viewOrder - comma delimited sort order w/ +ascend and -descend Parameters: ql - query language Parameters: csid - Compass Server ID (can be null for server's default csid) Parameters: RDMServer - Compass server URL, eg, http://compass/ |
doQuery | public void doQuery()(Code) | | Execute the query.
Note: Query results are concatenated into a single StringBuffer.
Use
Search.doQuery(int,int) to process search results iteratively.
|
doQuery | public void doQuery(int firstHit, int viewHits)(Code) | | Execute the query, returning viewHits hits starting at firstHit.
|
getDocumentCount | public int getDocumentCount()(Code) | | The total number of documents available to be searched.
since: 3.01C |
getHitCount | public int getHitCount()(Code) | | The total number of results that matched the search.
since: 3.01C |
getQuery | public String getQuery()(Code) | | Return the fully formatted query url sent to the server.
|
getRDMHeaderSOIF | public SOIF getRDMHeaderSOIF()(Code) | | Return the SOIF RDM result header. Returns null if the
status is not COMPLETE. Note that an ABEND returns
a null.
|
getRDMServer | public String getRDMServer()(Code) | | Returns the current RDMServer variable.
since: 3.01C |
getResultCount | public int getResultCount()(Code) | | The number of results returned by the search.
Returns -1 on error.
The result count is based on the RDM header SOIF,
so if doSOIFParse is false, -1 will be returned.
since: 3.01C |
getSOIFResult | public SOIF getSOIFResult()(Code) | | Return SOIF version of result. Returns null if the
status is not COMPLETE. Note that an ABEND returns
a null.
|
getStatus | final public int getStatus()(Code) | | Return processing status.
|
getStringResult | public String getStringResult()(Code) | | Return result. Returns null if the status is not
COMPLETE. Note that an ABEND returns a null.
|
getViewAttributes | public String getViewAttributes()(Code) | | Returns the SOIF attributes which are retrieved by a search.
viewAttributes as set by setViewAttributes.A comma delimited list of attributes, returned by a search, eg "score,title,description,url" NB: a null string denotes that ALL SOIF attributes are returned. See Also: Search.setViewAttributes since: 3.01C |
getViewOrder | public String getViewOrder()(Code) | | Gets the sorting order for results.
Parameters: strVal - A null string will return sorting according tothe server default of -score (descending relevance). A commadelimited list of attributes is accepted, with + to denoteascending order and - to denote descending order, eg "-score,+title"
See Also: Search.setViewOrder since: 3.01C |
isFinished | final public boolean isFinished()(Code) | | Return whether or not processing is complete.
since: 3.01C |
resultCount | public int resultCount()(Code) | | The number of results returned by this search.
Returns -1 on error.
The result count is based on the RDM header SOIF,
so if doSOIFParse is false, -1 will be returned.
Search.getResultCount() |
setQueryLanguage | public void setQueryLanguage(String ql)(Code) | | Sets the query language.
Parameters: ql - Can be one of:- compass: The default Compass query language. Searches documents or the taxonomy.
- taxonomy-basic: Used for requesting branches or parts of the taxonomy.
- schema-basic: Queries the Compass schema.
- url: Retrieves RDs by url (scope=url).
See Also: Search.getQueryLanguage See Also: Search.setRDMType since: 3.01C |
setRDMServer | public void setRDMServer(String RDMServer)(Code) | | Sets the RDMServer variable.
Parameters: RDMServer - The Compass server:port root, eg, http://compass.domain.com:111/ since: 3.01C |
setRDMType | public void setRDMType(String RDMType)(Code) | | Sets the RDM Request type.
Parameters: RDMType - Can be one of:- rd-request: The default request. Resource descriptions (documents).
- taxonomy-request: Taxonomy.
- schema-request: The schema.
- server-request: Server information.
- status-request: Server status information.
See Also: Search.getRDMType See Also: Search.setQueryLanguage since: 3.01C |
setSOIFParse | public void setSOIFParse(boolean b)(Code) | | Set whether SOIF parsing is to be done or not.
This can only be set when the status is PREPARED.
By default, SOIF parsing is true.
|
setStreamMode | public void setStreamMode(boolean m)(Code) | | Sets whether streaming is enabled or disabled.
By default, this is set to false.
When stream mode is enabled, the search results
RDM header SOIF will still be parsed, so that
result, hit and document counts are available, but
the document hit data will not be parsed. Instead, use
Search.getResultStream to access the document
SOIF DataInputStream directly.
since: 3.01C |
setViewAttributes | public void setViewAttributes(String viewAttributes)(Code) | | Sets the SOIF attributes which are returned for the search.
Parameters: viewAttributes - A null string will return all attributes.A comma delimited list of attributes is accepted, eg "score,title,description,url" See Also: Search.getViewAttributes since: 3.01C |
setViewHits | public void setViewHits(int viewHits)(Code) | | Set the maximum number of hits returned.
See Also: Search.getViewHits |
setViewOrder | public void setViewOrder(String viewOrder)(Code) | | Sets the sorting order for results.
Parameters: viewOrder - A null string will return sorting according tothe server default of -score (descending relevance). A comma delimitedlist of attributes is accepted, with + to denote ascending order and - todenote descending order, eg "-score,-title,+description"
See Also: Search.getViewOrder since: 3.01C |
toString | public String toString()(Code) | | Return debug string version of Search instance.
|
|
|