mirror of https://github.com/apache/lucene.git
SOLR-654 -- add setResponse( NamedList<Object> rsp ) to SolrResponse base class and remove the constructor initalization from the implementaions
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@679649 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d5a66e7bc9
commit
0f5af69cff
|
@ -30,5 +30,6 @@ import org.apache.solr.common.util.NamedList;
|
|||
public abstract class SolrResponse implements Serializable
|
||||
{
|
||||
public abstract long getElapsedTime();
|
||||
public abstract void setResponse( NamedList<Object> rsp );
|
||||
public abstract NamedList<Object> getResponse();
|
||||
}
|
||||
|
|
|
@ -58,7 +58,8 @@ public class DirectXmlRequest extends SolrRequest
|
|||
public UpdateResponse process( SolrServer server ) throws SolrServerException, IOException
|
||||
{
|
||||
long startTime = System.currentTimeMillis();
|
||||
UpdateResponse res = new UpdateResponse( server.request( this ) );
|
||||
UpdateResponse res = new UpdateResponse();
|
||||
res.setResponse( server.request( this ) );
|
||||
res.setElapsedTime( System.currentTimeMillis()-startTime );
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,8 @@ public class LukeRequest extends SolrRequest
|
|||
public LukeResponse process( SolrServer server ) throws SolrServerException, IOException
|
||||
{
|
||||
long startTime = System.currentTimeMillis();
|
||||
LukeResponse res = new LukeResponse( server.request( this ) );
|
||||
LukeResponse res = new LukeResponse();
|
||||
res.setResponse( server.request( this ) );
|
||||
res.setElapsedTime( System.currentTimeMillis()-startTime );
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -130,7 +130,8 @@ public class MultiCoreRequest extends SolrRequest
|
|||
public MultiCoreResponse process(SolrServer server) throws SolrServerException, IOException
|
||||
{
|
||||
long startTime = System.currentTimeMillis();
|
||||
MultiCoreResponse res = new MultiCoreResponse( server.request( this ) );
|
||||
MultiCoreResponse res = new MultiCoreResponse();
|
||||
res.setResponse( server.request( this ) );
|
||||
res.setElapsedTime( System.currentTimeMillis()-startTime );
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,8 @@ public class SolrPing extends SolrRequest
|
|||
public SolrPingResponse process( SolrServer server ) throws SolrServerException, IOException
|
||||
{
|
||||
long startTime = System.currentTimeMillis();
|
||||
SolrPingResponse res = new SolrPingResponse( server.request( this ) );
|
||||
SolrPingResponse res = new SolrPingResponse();
|
||||
res.setResponse( server.request( this ) );
|
||||
res.setElapsedTime( System.currentTimeMillis()-startTime );
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -213,7 +213,8 @@ public class UpdateRequest extends SolrRequest
|
|||
public UpdateResponse process( SolrServer server ) throws SolrServerException, IOException
|
||||
{
|
||||
long startTime = System.currentTimeMillis();
|
||||
UpdateResponse res = new UpdateResponse( server.request( this ) );
|
||||
UpdateResponse res = new UpdateResponse();
|
||||
res.setResponse( server.request( this ) );
|
||||
res.setElapsedTime( System.currentTimeMillis()-startTime );
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -188,9 +188,10 @@ public class LukeResponse extends SolrResponseBase {
|
|||
private Map<String, FieldInfo> fieldInfo;
|
||||
private Map<String, FieldTypeInfo> fieldTypeInfo;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public LukeResponse(NamedList<Object> res) {
|
||||
super(res);
|
||||
public void setResponse(NamedList<Object> res) {
|
||||
super.setResponse(res);
|
||||
|
||||
// Parse indexinfo
|
||||
indexInfo = (NamedList<Object>) res.get("index");
|
||||
|
|
|
@ -26,11 +26,7 @@ import org.apache.solr.common.util.NamedList;
|
|||
* @since solr 1.3
|
||||
*/
|
||||
public class MultiCoreResponse extends SolrResponseBase
|
||||
{
|
||||
public MultiCoreResponse(NamedList<Object> res) {
|
||||
super(res);
|
||||
}
|
||||
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public NamedList<NamedList<Object>> getCoreStatus()
|
||||
{
|
||||
|
|
|
@ -58,16 +58,24 @@ public class QueryResponse extends SolrResponseBase
|
|||
private Map<String,String> _explainMap = null;
|
||||
|
||||
// utility variable used for automatic binding -- it should not be serialized
|
||||
private transient SolrServer solrServer;
|
||||
private transient final SolrServer solrServer;
|
||||
|
||||
public QueryResponse(){
|
||||
solrServer = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility constructor to set the solrServer and namedList
|
||||
*/
|
||||
public QueryResponse( NamedList<Object> res , SolrServer solrServer){
|
||||
this(res);
|
||||
this.setResponse( res );
|
||||
this.solrServer = solrServer;
|
||||
}
|
||||
|
||||
public QueryResponse( NamedList<Object> res )
|
||||
@Override
|
||||
public void setResponse( NamedList<Object> res )
|
||||
{
|
||||
super( res );
|
||||
super.setResponse( res );
|
||||
|
||||
// Look for known things
|
||||
for( int i=0; i<res.size(); i++ ) {
|
||||
|
|
|
@ -26,7 +26,5 @@ import org.apache.solr.common.util.NamedList;
|
|||
*/
|
||||
public class SolrPingResponse extends SolrResponseBase
|
||||
{
|
||||
public SolrPingResponse(NamedList<Object> res) {
|
||||
super(res);
|
||||
}
|
||||
// nothing special now...
|
||||
}
|
||||
|
|
|
@ -31,11 +31,6 @@ public class SolrResponseBase extends SolrResponse
|
|||
private NamedList<Object> response = null;
|
||||
private String requestUrl = null;
|
||||
|
||||
public SolrResponseBase( NamedList<Object> res )
|
||||
{
|
||||
response = res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getElapsedTime() {
|
||||
return elapsedTime;
|
||||
|
@ -50,6 +45,7 @@ public class SolrResponseBase extends SolrResponse
|
|||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResponse(NamedList<Object> response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,5 @@ import org.apache.solr.common.util.NamedList;
|
|||
*/
|
||||
public class UpdateResponse extends SolrResponseBase
|
||||
{
|
||||
public UpdateResponse(NamedList<Object> res) {
|
||||
super(res);
|
||||
}
|
||||
// nothing special now...
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class TestDocumentObjectBinder extends TestCase
|
|||
XMLResponseParser parser = new XMLResponseParser();
|
||||
NamedList<Object> nl = null;
|
||||
nl = parser.processResponse(new StringReader(xml));
|
||||
QueryResponse res = new QueryResponse(nl);
|
||||
QueryResponse res = new QueryResponse(nl, null);
|
||||
SolrDocumentList solDocList = res.getResults();
|
||||
List<Item> l = binder.getBeans(Item.class,res.getResults());
|
||||
Assert.assertEquals(solDocList.size(), l.size());
|
||||
|
|
|
@ -42,7 +42,7 @@ public class QueryResponseTest {
|
|||
NamedList<Object> response = parser.processResponse(in);
|
||||
in.close();
|
||||
|
||||
QueryResponse qr = new QueryResponse(response);
|
||||
QueryResponse qr = new QueryResponse(response, null);
|
||||
Assert.assertNotNull(qr);
|
||||
|
||||
Assert.assertNotNull(qr.getFacetDates());
|
||||
|
|
|
@ -332,13 +332,21 @@ class HttpCommComponent {
|
|||
private static class SimpleSolrResponse extends SolrResponse {
|
||||
long elapsedTime;
|
||||
NamedList<Object> nl;
|
||||
|
||||
@Override
|
||||
public long getElapsedTime() {
|
||||
return elapsedTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamedList<Object> getResponse() {
|
||||
return nl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResponse(NamedList<Object> rsp) {
|
||||
nl = rsp;
|
||||
}
|
||||
}
|
||||
|
||||
void submit(final ShardRequest sreq, final String shard, final ModifiableSolrParams params) {
|
||||
|
|
Loading…
Reference in New Issue