org.apache.solr.response
public class SolrQueryResponse extends Object
SolrQueryResponse
is used by a query handler to return
the response to a query request.
Note On Returnable Data...
A SolrQueryResponse
may contain the following types of
Objects generated by the SolrRequestHandler
that processed
the request.
String
Integer
Long
Float
Double
Boolean
Date
DocList
SolrDocument
(since 1.3)SolrDocumentList
(since 1.3)Map
containing any of the items in this listNamedList
containing any of the items in this listCollection
containing any of the items in this listOther data types may be added to the SolrQueryResponse, but there is no guarantee that QueryResponseWriters will be able to deal with unexpected types.
Modifier and Type | Field and Description |
---|---|
protected long |
endtime
The endtime of the request in milliseconds.
|
protected Exception |
err |
protected boolean |
httpCaching
Should this response be tagged with HTTP caching headers?
|
protected ReturnFields |
returnFields |
protected NamedList<Object> |
toLog
Container for storing information that should be logged by Solr before returning.
|
protected NamedList<Object> |
values
Container for user defined values
|
Constructor and Description |
---|
SolrQueryResponse()
// another way of returning an error
int errCode;
String errMsg;
|
Modifier and Type | Method and Description |
---|---|
void |
add(String name,
Object val)
Appends a named value to the list of named values to be returned.
|
void |
addToLog(String name,
Object val)
Add a value to be logged.
|
long |
getEndTime()
Get the time in milliseconds when the response officially finished.
|
Exception |
getException()
Returns an Exception if there was a fatal error in processing the request.
|
NamedList<Object> |
getResponseHeader()
Repsonse header to be logged
|
ReturnFields |
getReturnFields()
Gets the document field names of fields to return by default when
returning DocLists
|
NamedList<Object> |
getToLog()
Get loggable items.
|
String |
getToLogAsString(String logid)
Returns a string of the form "logid name1=value1 name2=value2 ..."
|
NamedList |
getValues()
Gets data to be returned in this response
|
boolean |
isHttpCaching()
Should this response emit HTTP caching headers?
|
void |
setAllValues(NamedList<Object> nameValuePairs)
Sets data to be returned in this response
|
long |
setEndTime()
Stop the timer for how long this query took.
|
long |
setEndTime(long endtime)
Set the in milliseconds when the response officially finished.
|
void |
setException(Exception e)
Causes an error to be returned instead of the results.
|
void |
setHttpCaching(boolean httpCaching)
Enables or disables the emission of HTTP caching headers for this response.
|
void |
setReturnFields(ReturnFields fields)
Sets the document field names of fields to return by default when
returning DocLists
|
protected NamedList<Object> toLog
protected ReturnFields returnFields
protected Exception err
protected boolean httpCaching
protected long endtime
setEndTime(long)
,
getEndTime()
public SolrQueryResponse()
public NamedList getValues()
public void setAllValues(NamedList<Object> nameValuePairs)
public void setReturnFields(ReturnFields fields)
public ReturnFields getReturnFields()
public void add(String name, Object val)
name
- the name of the value - may be null if unnamedval
- the value to add - also may be null since null is a legal valuepublic void setException(Exception e)
public Exception getException()
public long getEndTime()
public long setEndTime()
setEndTime(long)
public long setEndTime(long endtime)
setEndTime()
public void addToLog(String name, Object val)
name
- name of the thing to logval
- value of the thing to logpublic String getToLogAsString(String logid)
public void setHttpCaching(boolean httpCaching)
httpCaching
- true=emit caching headers, false otherwisepublic boolean isHttpCaching()
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.