SOLR-536 -- putting back the getBeans function, and keeping SolrServer as a transient variable

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@671037 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2008-06-24 06:10:31 +00:00
parent 0737e7469d
commit 81d4040cff
2 changed files with 14 additions and 1 deletions

View File

@ -81,7 +81,7 @@ public class QueryRequest extends SolrRequest
try
{
long startTime = System.currentTimeMillis();
QueryResponse res = new QueryResponse( server.request( this ) );
QueryResponse res = new QueryResponse( server.request( this ), server );
res.setElapsedTime( System.currentTimeMillis()-startTime );
return res;
}

View File

@ -57,6 +57,13 @@ public class QueryResponse extends SolrResponseBase
private Map<String,Object> _debugMap = null;
private Map<String,String> _explainMap = null;
// utility variable used for automatic binding -- it should not be serialized
private transient SolrServer solrServer;
public QueryResponse( NamedList<Object> res , SolrServer solrServer){
this(res);
this.solrServer = solrServer;
}
public QueryResponse( NamedList<Object> res )
{
@ -244,6 +251,12 @@ public class QueryResponse extends SolrResponseBase
public List<FacetField> getLimitingFacets() {
return _limitingFacets;
}
public <T> List<T> getBeans(Class<T> type){
return solrServer == null ?
new DocumentObjectBinder().getBeans(type,_results):
solrServer.getBinder().getBeans(type, _results);
}
}