本文整理汇总了Java中org.apache.solr.request.SolrQueryRequest.getStartTime方法的典型用法代码示例。如果您正苦于以下问题:Java SolrQueryRequest.getStartTime方法的具体用法?Java SolrQueryRequest.getStartTime怎么用?Java SolrQueryRequest.getStartTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.request.SolrQueryRequest
的用法示例。
在下文中一共展示了SolrQueryRequest.getStartTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: if
import org.apache.solr.request.SolrQueryRequest; //导入方法依赖的package包/类
/** Put status, QTime, and possibly request handler and params, in the response header */
public static void postDecorateResponse
(SolrRequestHandler handler, SolrQueryRequest req, SolrQueryResponse rsp) {
// TODO should check that responseHeader has not been replaced by handler
NamedList<Object> responseHeader = rsp.getResponseHeader();
final int qtime=(int)(rsp.getEndTime() - req.getStartTime());
int status = 0;
Exception exception = rsp.getException();
if( exception != null ){
if( exception instanceof SolrException )
status = ((SolrException)exception).code();
else
status = 500;
}
responseHeader.add("status",status);
responseHeader.add("QTime",qtime);
if (rsp.getToLog().size() > 0) {
rsp.getToLog().add("status",status);
rsp.getToLog().add("QTime",qtime);
}
SolrParams params = req.getParams();
if( null != handler && params.getBool(CommonParams.HEADER_ECHO_HANDLER, false) ) {
responseHeader.add("handler", handler.getName() );
}
// Values for echoParams... false/true/all or false/explicit/all ???
String ep = params.get( CommonParams.HEADER_ECHO_PARAMS, null );
if( ep != null ) {
EchoParamStyle echoParams = EchoParamStyle.get( ep );
if( echoParams == null ) {
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Invalid value '" + ep + "' for " + CommonParams.HEADER_ECHO_PARAMS
+ " parameter, use '" + EchoParamStyle.EXPLICIT + "' or '" + EchoParamStyle.ALL + "'" );
}
if( echoParams == EchoParamStyle.EXPLICIT ) {
responseHeader.add("params", req.getOriginalParams().toNamedList());
} else if( echoParams == EchoParamStyle.ALL ) {
responseHeader.add("params", req.getParams().toNamedList());
}
}
}