public class SearchHandle extends BaseHandle<InputStream,OperationNotSupported> implements SearchReadHandle, SearchResults
A SearchHandle represents a set of search results returned by the server.
The precise nature of the results returned depends on the query options used for the search and on the configuration of this handle.
Snippets, in particular, are returned in various ways. In the default case, snippets are
returned as Java objects. For custom or raw snippets, DOM documents are returned. The
forceDOM flag can be set to cause the handle to always return DOM documents,
even in the default case.
| Modifier and Type | Class and Description |
|---|---|
static class |
SearchHandle.Report
Represents a report message.
|
static class |
SearchHandle.Warning
Represents a warning.
|
UNKNOWN_LENGTH| Constructor and Description |
|---|
SearchHandle() |
| Modifier and Type | Method and Description |
|---|---|
<T extends XMLReadHandle> |
getConstraint(String name,
T handle)
Returns the named constraint used in the search (if requested).
|
<T extends XMLReadHandle> |
getConstraintIterator(T handle)
Returns an iterator over the constraints used in the search (if requested).
|
String[] |
getConstraintNames()
Returns the array of constraint names used in the search (if requested).
|
String[] |
getFacetNames()
Returns a list of the facet names returned in this search.
|
FacetResult |
getFacetResult(String name)
Returns the named facet results.
|
FacetResult[] |
getFacetResults()
Returns an array of facet results for this search.
|
MatchDocumentSummary[] |
getMatchResults()
Returns an array of summaries for the matched documents.
|
SearchMetrics |
getMetrics()
Returns the metrics associated with this search.
|
int |
getPageLength()
Returns the page length for this search.
|
Document |
getPlan()
Returns the query plan associated with this search.
|
<T extends XMLReadHandle> |
getPlan(T handle)
Returns the plan for the search (if requested).
|
<T extends XMLReadHandle> |
getQuery(T handle)
Returns the cts:query used in the search (if requested).
|
QueryDefinition |
getQueryCriteria()
Returns the query definition used for the search represented by this handle.
|
SearchHandle.Report[] |
getReports()
Returns an array of any reports associated with this search.
|
String |
getSnippetTransformType()
Identifies whether results have default, raw document, customer, or no snippets.
|
long |
getStart()
Returns the start page for this search.
|
String[] |
getStringQueries()
Returns the list of string queries, if specified by the query options.
|
long |
getTotalResults()
Returns the total number of results in this search.
|
SearchHandle.Warning[] |
getWarnings()
Returns an array of any warnings associated with this search.
|
void |
setFormat(Format format)
Sets the format associated with this handle.
|
void |
setHandleRegistry(DatabaseClientFactory.HandleFactoryRegistry registry)
Makes the handle registry for this database client available to this SearchHandle during processing of the search response.
|
void |
setQueryCriteria(QueryDefinition querydef)
Sets the query definition used in the search.
|
SearchHandle |
withFormat(Format format)
Fluent setter for the format associated with this handle.
|
getByteLength, getFormat, getMimetype, getServerTimestamp, setByteLength, setMimetype, setServerTimestamppublic void setFormat(Format format)
Sets the format associated with this handle.
This handle only supports XML.
setFormat in interface ContentDescriptorsetFormat in class BaseHandle<InputStream,OperationNotSupported>format - The format, which must be Format.XML or an exception will be raised.public SearchHandle withFormat(Format format)
Fluent setter for the format associated with this handle.
This handle only supports XML.
format - The format, which must be Format.XML or an exception will be raised.public void setQueryCriteria(QueryDefinition querydef)
Sets the query definition used in the search.
Calling this method always deletes any cached search results.
querydef - The new QueryDefinitionpublic QueryDefinition getQueryCriteria()
Returns the query definition used for the search represented by this handle.
getQueryCriteria in interface SearchResultspublic final void setHandleRegistry(DatabaseClientFactory.HandleFactoryRegistry registry)
Makes the handle registry for this database client available to this SearchHandle during processing of the search response.
registry - the registry of IO representation classes for this database clientpublic long getTotalResults()
Returns the total number of results in this search.
getTotalResults in interface SearchResultspublic long getStart()
Returns the start page for this search.
getStart in interface SearchResultspublic int getPageLength()
Returns the page length for this search.
getPageLength in interface SearchResultspublic String getSnippetTransformType()
Identifies whether results have default, raw document, customer, or no snippets.
getSnippetTransformType in interface SearchResultspublic String[] getStringQueries()
Returns the list of string queries, if specified by the query options.
getStringQueries in interface SearchResultspublic <T extends XMLReadHandle> T getQuery(T handle)
SearchResultsReturns the cts:query used in the search (if requested).
getQuery in interface SearchResultsT - the type of XMLReadHandle to returnhandle - An XML handle for reading the query.public SearchMetrics getMetrics()
Returns the metrics associated with this search.
getMetrics in interface SearchResultspublic MatchDocumentSummary[] getMatchResults()
Returns an array of summaries for the matched documents.
getMatchResults in interface SearchResultspublic String[] getFacetNames()
Returns a list of the facet names returned in this search.
getFacetNames in interface SearchResultspublic FacetResult getFacetResult(String name)
Returns the named facet results.
getFacetResult in interface SearchResultsname - The name of the facet.public FacetResult[] getFacetResults()
Returns an array of facet results for this search.
getFacetResults in interface SearchResultspublic String[] getConstraintNames()
SearchResultsReturns the array of constraint names used in the search (if requested).
getConstraintNames in interface SearchResultspublic <T extends XMLReadHandle> T getConstraint(String name, T handle)
SearchResultsReturns the named constraint used in the search (if requested).
getConstraint in interface SearchResultsT - the type of XMLReadHandle to returnname - The constraint name.handle - An XML handle for reading the constraint.public <T extends XMLReadHandle> Iterator<T> getConstraintIterator(T handle)
SearchResultsReturns an iterator over the constraints used in the search (if requested).
getConstraintIterator in interface SearchResultsT - the type of XMLReadHandle’s to return in the Iteratorhandle - An XML handle for reading the constraints.public Document getPlan()
Returns the query plan associated with this search.
Query plans are highly variable.
getPlan in interface SearchResultspublic <T extends XMLReadHandle> T getPlan(T handle)
SearchResultsReturns the plan for the search (if requested).
getPlan in interface SearchResultsT - the type of XMLReadHandle to returnhandle - An XML handle for reading the plan.public SearchHandle.Warning[] getWarnings()
Returns an array of any warnings associated with this search.
getWarnings in interface SearchResultspublic SearchHandle.Report[] getReports()
Returns an array of any reports associated with this search.
getReports in interface SearchResultsCopyright © 2013-2017 MarkLogic Corporation.