public class SearchHandle extends BaseHandle<java.io.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(java.lang.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).
|
java.lang.String[] |
getConstraintNames()
Returns the array of constraint names used in
the search (if requested).
|
java.lang.String[] |
getFacetNames()
Returns a list of the facet names returned in
this search.
|
FacetResult |
getFacetResult(java.lang.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.
|
org.w3c.dom.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).
|
SearchQueryDefinition |
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.
|
java.lang.String |
getSnippetTransformType()
Identifies whether results have default, raw
document, customer, or no snippets.
|
long |
getStart()
Returns the start page for this search.
|
java.lang.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.
|
protected
java.lang.Class<java.io.InputStream> |
receiveAs() |
protected void |
receiveContent(java.io.InputStream content) |
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(SearchQueryDefinition 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,
setServerTimestamp
public void setFormat(Format format)
setFormat
in interface ContentDescriptor
setFormat
in class BaseHandle<java.io.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.protected java.lang.Class<java.io.InputStream> receiveAs()
receiveAs
in
class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OperationNotSupported>
protected void receiveContent(java.io.InputStream content)
receiveContent
in
class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OperationNotSupported>
public void setQueryCriteria(SearchQueryDefinition querydef)
Calling this method always deletes any cached search results.
querydef
- The new QueryDefinitionpublic SearchQueryDefinition 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 java.lang.String getSnippetTransformType()
getSnippetTransformType
in
interface SearchResults
public java.lang.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 java.lang.String[] getFacetNames()
getFacetNames
in interface SearchResults
public FacetResult getFacetResult(java.lang.String name)
getFacetResult
in interface SearchResults
name
- The name of the facet.public FacetResult[] getFacetResults()
getFacetResults
in interface SearchResults
public java.lang.String[] getConstraintNames()
SearchResults
getConstraintNames
in interface SearchResults
public <T extends XMLReadHandle> T getConstraint(java.lang.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> java.util.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 org.w3c.dom.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 © 2024 MarkLogic Corporation. All Rights Reserved.