public class QueryResponseImpl extends ResponseImpl<QueryRequest> implements QueryResponse
Modifier and Type | Class and Description |
---|---|
protected static class |
QueryResponseImpl.POISON_PILL_RESULT |
Modifier and Type | Field and Description |
---|---|
protected long |
hits |
protected boolean |
isQueueClosed |
protected static Result |
POISON_PILL_RESULT |
request
ELAPSED_TIME, SITE_LIST, TOTAL_HITS, TOTAL_RESULTS_RETURNED
Constructor and Description |
---|
QueryResponseImpl(QueryRequest request)
Instantiates a new QueryResponseImpl with a $(@link QueryRequest)
|
QueryResponseImpl(QueryRequest request,
List<Result> results,
boolean closeResultQueue,
long hits)
Instantiates a new QueryResponseImpl with a $(@link QueryRequest), a $
List of results,
a closeResultQueue indicator, and a number of hits to return |
QueryResponseImpl(QueryRequest request,
List<Result> results,
boolean closeResultQueue,
long hits,
Map<String,Serializable> properties)
|
QueryResponseImpl(QueryRequest request,
List<Result> results,
long totalHits)
Instantiates a new QueryResponseImpl with a $(@link QueryRequest) and and a $
List of
results |
QueryResponseImpl(QueryRequest request,
Map<String,Serializable> properties)
Instantiates a new QueryResponseImpl with a $(@link QueryRequest) and and a $
Map of
properties |
QueryResponseImpl(SourceResponse response,
String sourceId)
Construct from an underlying
SourceResponse |
Modifier and Type | Method and Description |
---|---|
void |
addResult(Result result,
boolean closeQueue)
Adds a $
Result to this QueryResponse, and specifies whether or not to close the queue |
void |
addResults(List<Result> results,
boolean closeQueue)
|
void |
closeResultQueue() |
long |
getHits()
|
Set<ProcessingDetails> |
getProcessingDetails()
Get any specific details about the execution of the
QueryRequest associated with this
SourceResponse . |
List<Result> |
getResults()
Get the
Result s of the associated QueryRequest |
boolean |
hasMoreResults() |
Result |
poll() |
Result |
poll(long timeout) |
void |
setHits(long hits) |
void |
setProcessingDetails(Set<ProcessingDetails> set) |
Result |
take() |
List<Result> |
take(long size) |
getRequest
containsPropertyName, getProperties, getPropertyNames, getPropertyValue, hasProperties, setProperties
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProcessingErrors, getRequest
containsPropertyName, getProperties, getPropertyNames, getPropertyValue, hasProperties
protected static final Result POISON_PILL_RESULT
protected long hits
protected boolean isQueueClosed
public QueryResponseImpl(QueryRequest request)
request
- the requestpublic QueryResponseImpl(QueryRequest request, Map<String,Serializable> properties)
Map
of
propertiesrequest
- the requestproperties
- public QueryResponseImpl(QueryRequest request, List<Result> results, long totalHits)
List
of
resultsrequest
- the requestresults
- the resultspublic QueryResponseImpl(QueryRequest request, List<Result> results, boolean closeResultQueue, long hits)
List
of results,
a closeResultQueue indicator, and a number of hits to returnrequest
- the requestresults
- the resultshits
- the hitspublic QueryResponseImpl(QueryRequest request, List<Result> results, boolean closeResultQueue, long hits, Map<String,Serializable> properties)
List
of results,
a closeResultQueue indicator, a number of hits to return, and a $Map
of propertiesrequest
- the requestresults
- the resultshits
- the hitsproperties
- the propertiespublic QueryResponseImpl(SourceResponse response, String sourceId)
SourceResponse
response
- sourceId
- public long getHits()
SourceResponse
Query
for the associated Source
, -1 if unknown. This is typically more than the number of Result
s returned from SourceResponse.getResults()
.getHits
in interface SourceResponse
Query
, -1 if unknown.public void setHits(long hits)
public Set<ProcessingDetails> getProcessingDetails()
SourceResponse
QueryRequest
associated with this
SourceResponse
. Must not be null.getProcessingDetails
in interface QueryResponse
getProcessingDetails
in interface SourceResponse
public void setProcessingDetails(Set<ProcessingDetails> set)
public List<Result> getResults()
SourceResponse
Result
s of the associated QueryRequest
getResults
in interface SourceResponse
public void addResult(Result result, boolean closeQueue)
Result
to this QueryResponse, and specifies whether or not to close the queueresult
- the resultcloseQueue
- the indicator for closing of the queuepublic void addResults(List<Result> results, boolean closeQueue)
results
- the resultscloseQueue
- the indicator for closing of the queuepublic boolean hasMoreResults()
hasMoreResults
in interface QueryResponse
public void closeResultQueue()
public Result poll()
poll
in interface QueryResponse
public Result poll(long timeout)
poll
in interface QueryResponse
public Result take()
take
in interface QueryResponse
public List<Result> take(long size)
take
in interface QueryResponse
This work is licensed under a Creative Commons Attribution 4.0 International License.