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, setMimetype
public void setFormat(Format format)
setFormat
in interface ContentDescriptor
setFormat
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 SearchResults
public final void setHandleRegistry(DatabaseClientFactory.HandleFactoryRegistry registry)
registry
- the registry of IO representation classes for this database clientpublic long getTotalResults()
getTotalResults
in interface SearchResults
public long getStart()
getStart
in interface SearchResults
public int getPageLength()
getPageLength
in interface SearchResults
public String getSnippetTransformType()
getSnippetTransformType
in interface SearchResults
public String[] getStringQueries()
getStringQueries
in interface SearchResults
public <T extends XMLReadHandle> T getQuery(T handle)
SearchResults
getQuery
in interface SearchResults
T
- the type of XMLReadHandle to returnhandle
- An XML handle for reading the query.public SearchMetrics getMetrics()
getMetrics
in interface SearchResults
public MatchDocumentSummary[] getMatchResults()
getMatchResults
in interface SearchResults
public String[] getFacetNames()
getFacetNames
in interface SearchResults
public FacetResult getFacetResult(String name)
getFacetResult
in interface SearchResults
name
- The name of the facet.public FacetResult[] getFacetResults()
getFacetResults
in interface SearchResults
public String[] getConstraintNames()
SearchResults
getConstraintNames
in interface SearchResults
public <T extends XMLReadHandle> T getConstraint(String name, T handle)
SearchResults
getConstraint
in interface SearchResults
T
- 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)
SearchResults
getConstraintIterator
in interface SearchResults
T
- 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 SearchResults
public <T extends XMLReadHandle> T getPlan(T handle)
SearchResults
getPlan
in interface SearchResults
T
- the type of XMLReadHandle to returnhandle
- An XML handle for reading the plan.public SearchHandle.Warning[] getWarnings()
getWarnings
in interface SearchResults
public SearchHandle.Report[] getReports()
getReports
in interface SearchResults
Copyright © 2013-2016 MarkLogic Corporation.