From f2971ef476d74bd239d24c9c6a5c2fca70ef2f8d Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Mon, 22 Jun 2009 05:34:28 +0000 Subject: [PATCH] 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 --- .../org/apache/solr/request/BinaryResponseWriter.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/java/org/apache/solr/request/BinaryResponseWriter.java b/src/java/org/apache/solr/request/BinaryResponseWriter.java index 793a5909339..3a6686417f6 100755 --- a/src/java/org/apache/solr/request/BinaryResponseWriter.java +++ b/src/java/org/apache/solr/request/BinaryResponseWriter.java @@ -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 returnFields; private final boolean includeScore; @@ -71,8 +72,7 @@ public class BinaryResponseWriter implements BinaryQueryResponseWriter { boolean useFieldObjects = true; public Resolver(SolrQueryRequest req, Set 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();