public final class Result extends com.yahoo.processing.Response implements Cloneable
Modifier and Type | Field and Description |
---|---|
private Coverage |
coverage
Coverage information for this result.
|
private long |
deepHitCount
The estimated total number of deep hits, which includes every object which matches the query.
|
private com.yahoo.collections.ListMap<String,String> |
headers
Headers containing "envelope" meta information to be returned with this result.
|
private HitGroup |
hits
The top level hit group of this result
|
private Templating |
templating
Result rendering infrastructure.
|
private ElapsedTime |
timeAccountant
The time spent producing this result
|
private long |
totalHitCount
The estimated total number of hits which would in theory be displayed this result is a part of
|
Constructor and Description |
---|
Result(Query query)
Creates a new Result where the top level hit group has id "toplevel"
|
Result(Query query,
ErrorMessage errorMessage)
Create a result containing an error
|
Result(Query query,
HitGroup hits)
Create an empty result.
|
Modifier and Type | Method and Description |
---|---|
void |
analyzeHits()
Update cached and filled by iterating through the hits of this result
|
Result |
clone()
Deep clones this result - copies are made of all hits and subgroups of hits,
but not of the query referenced by this.
|
com.yahoo.processing.response.DataList<?> |
data() |
int |
getConcreteHitCount()
Returns the total number of concrete hits contained (directly or in subgroups) in this result.
|
QueryContext |
getContext(boolean create)
Returns the context of this result - this is equal to getQuery().getContext(create)
|
Coverage |
getCoverage(boolean create)
Returns coverage information
|
long |
getDeepHitCount()
Returns the estimated total number of deep hits, which includes every object which matches the query.
|
boolean |
getDeletionBreaksOrdering() |
ElapsedTime |
getElapsedTime() |
com.yahoo.collections.ListMap<String,String> |
getHeaders(boolean create)
Returns the set of "envelope" headers to be returned with this result.
|
int |
getHitCount()
Returns the number of hit objects available in the top level group of this result.
|
HitOrderer |
getHitOrderer()
Returns the orderer used by the top level group, or null if the default relevancy order is used
|
Query |
getQuery()
Returns the query which produced this result
|
Templating |
getTemplating()
The Templating object contains helper methods and data containers for
result rendering.
|
long |
getTotalHitCount()
Returns the estimated total number of concrete hits which would be returned for this query.
|
HitGroup |
hits()
Returns the top level hit group containing all the hits of this result
|
boolean |
isCached()
Returns true only if _all_ hits in this result originates from a cache.
|
boolean |
isFilled(String summaryClass)
Returns whether all hits in this result have been filled with
the properties contained in the given summary class.
|
void |
mergeWith(Result result)
Merges meta information from a result into this.
|
void |
mergeWithAfterFill(Result result)
Merges meta information produced when a Hit already
contained in this result has been filled using another
result as an intermediary.
|
void |
setCoverage(Coverage coverage) |
void |
setDeepHitCount(long deepHitCount)
Sets the estimated total number of deep hits this result is a subset of
|
void |
setDeletionBreaksOrdering(boolean flag) |
void |
setElapsedTime(ElapsedTime t) |
void |
setHitOrderer(HitOrderer hitOrderer)
Sets the hit orderer to be used for the top level hit group.
|
void |
setHits(HitGroup hits)
Sets the top level hit group containing all the hits of this result
|
void |
setQuery(Query query)
Sets a query for this result
|
void |
setTotalHitCount(long totalHitCount)
Sets the estimated total number of hits this result is a subset of
|
String |
toString() |
void |
trace(String name)
Adds a context message to this query containing the entire content of this result,
if tracelevel is 5 or more.
|
protected void |
traceExtraHitProperties(StringBuilder hitBuffer,
Hit hit)
For tracing custom properties of a hit, see trace(String).
|
addFreezeListener, freeze
private HitGroup hits
private long totalHitCount
private long deepHitCount
private ElapsedTime timeAccountant
private Coverage coverage
private com.yahoo.collections.ListMap<String,String> headers
private final Templating templating
public Result(Query query)
public Result(Query query, HitGroup hits)
setTotalHitCount(long)
before releasing this result.query
- the query which produced this resulthits
- the hit container which this will return from hits()
public Result(Query query, ErrorMessage errorMessage)
public void mergeWith(Result result)
public void mergeWithAfterFill(Result result)
public int getHitCount()
public int getConcreteHitCount()
Returns the total number of concrete hits contained (directly or in subgroups) in this result. This should equal the requested hits count if the query has that many matches.
public long getTotalHitCount()
public long getDeepHitCount()
public void setTotalHitCount(long totalHitCount)
public void setDeepHitCount(long deepHitCount)
public ElapsedTime getElapsedTime()
public void setElapsedTime(ElapsedTime t)
public boolean isCached()
public boolean isFilled(String summaryClass)
public Query getQuery()
public void setQuery(Query query)
public void setHitOrderer(HitOrderer hitOrderer)
Sets the hit orderer to be used for the top level hit group.
hitOrderer
- the new hit orderer, or null to use default relevancy orderingpublic HitOrderer getHitOrderer()
public void setDeletionBreaksOrdering(boolean flag)
public boolean getDeletionBreaksOrdering()
public void analyzeHits()
public HitGroup hits()
public com.yahoo.processing.response.DataList<?> data()
data
in class com.yahoo.processing.Response
public void setHits(HitGroup hits)
public Result clone()
clone
in class com.yahoo.component.provider.ListenableFreezableClass
public void trace(String name)
name
- the name of the searcher instance returning this resultprotected void traceExtraHitProperties(StringBuilder hitBuffer, Hit hit)
hitBuffer
- the render targethit
- the hit to be analyzedpublic QueryContext getContext(boolean create)
public void setCoverage(Coverage coverage)
public Coverage getCoverage(boolean create)
create
- if true the coverage information of this result is created if missingpublic com.yahoo.collections.ListMap<String,String> getHeaders(boolean create)
Used for HTTP headers when the return protocol is HTTP, e.g
result.getHeaders(true).put("Cache-Control","max-age=120")
create
- if true, create the header ListMap if it does not existcreateis false
public Templating getTemplating()
Copyright © 2017. All rights reserved.