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