public class SearchHandle extends BaseHandle<InputStream,OperationNotSupported> implements SearchReadHandle, SearchResults
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 |
setForceDOM(boolean forceDOM)
Deprecated.
|
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, setByteLength, setMimetypepublic void setFormat(Format format)
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)
format - The format, which must be Format.XML or an exception will be raised.@Deprecated public void setForceDOM(boolean forceDOM)
forceDOM - The flag setting.public void setQueryCriteria(QueryDefinition querydef)
Calling this method always deletes any cached search results.
querydef - The new QueryDefinitionpublic QueryDefinition getQueryCriteria()
getQueryCriteria in interface SearchResultspublic final void setHandleRegistry(DatabaseClientFactory.HandleFactoryRegistry registry)
registry - the registry of IO representation classes for this database clientpublic long getTotalResults()
getTotalResults in interface SearchResultspublic long getStart()
getStart in interface SearchResultspublic int getPageLength()
getPageLength in interface SearchResultspublic String getSnippetTransformType()
getSnippetTransformType in interface SearchResultspublic String[] getStringQueries()
getStringQueries in interface SearchResultspublic <T extends XMLReadHandle> T getQuery(T handle)
SearchResultsgetQuery in interface SearchResultsT - the type of XMLReadHandle to returnhandle - An XML handle for reading the query.public SearchMetrics getMetrics()
getMetrics in interface SearchResultspublic MatchDocumentSummary[] getMatchResults()
getMatchResults in interface SearchResultspublic String[] getFacetNames()
getFacetNames in interface SearchResultspublic FacetResult getFacetResult(String name)
getFacetResult in interface SearchResultsname - The name of the facet.public FacetResult[] getFacetResults()
getFacetResults in interface SearchResultspublic String[] getConstraintNames()
SearchResultsgetConstraintNames in interface SearchResultspublic <T extends XMLReadHandle> T getConstraint(String name, T handle)
SearchResultsgetConstraint 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)
SearchResultsgetConstraintIterator in interface SearchResultsT - the type of XMLReadHandle's to return in the Iteratorhandle - An XML handle for reading the constraints.public Document getPlan()
Query plans are highly variable.
getPlan in interface SearchResultspublic <T extends XMLReadHandle> T getPlan(T handle)
SearchResultsgetPlan in interface SearchResultsT - the type of XMLReadHandle to returnhandle - An XML handle for reading the plan.public SearchHandle.Warning[] getWarnings()
getWarnings in interface SearchResultspublic SearchHandle.Report[] getReports()
getReports in interface SearchResultsCopyright © 2013-2016 MarkLogic Corporation.