lazily get searcher and schema. for coreadmin requests it does not need these

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@787143 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2009-06-22 05:34:28 +00:00
parent e1a8f5e8b2
commit f2971ef476
1 changed files with 6 additions and 5 deletions

View File

@ -61,8 +61,9 @@ public class BinaryResponseWriter implements BinaryQueryResponseWriter {
}
private static class Resolver implements JavaBinCodec.ObjectResolver {
private final IndexSchema schema;
private final SolrIndexSearcher searcher;
private final SolrQueryRequest solrQueryRequest;
private IndexSchema schema;
private SolrIndexSearcher searcher;
private final Set<String> returnFields;
private final boolean includeScore;
@ -71,8 +72,7 @@ public class BinaryResponseWriter implements BinaryQueryResponseWriter {
boolean useFieldObjects = true;
public Resolver(SolrQueryRequest req, Set<String> returnFields) {
this.schema = req.getSchema();
this.searcher = req.getSearcher();
solrQueryRequest = req;
this.includeScore = returnFields != null && returnFields.contains("score");
if (returnFields != null) {
@ -114,7 +114,8 @@ public class BinaryResponseWriter implements BinaryQueryResponseWriter {
int sz = ids.size();
codec.writeTag(JavaBinCodec.ARR, sz);
if(searcher == null) searcher = solrQueryRequest.getSearcher();
if(schema == null) schema = solrQueryRequest.getSchema();
DocIterator iterator = ids.iterator();
for (int i = 0; i < sz; i++) {
int id = iterator.nextDoc();