So my implementation with a DocTransformer is causing an exception (with a
sharded collection):

ERROR - 2016-08-04 09:41:44.247; [ShardTest1 shard1_0 core_node3
ShardTest1_shard1_0_replica1] org.apache.solr.common.SolrException;
null:org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:
Error from server at
http://localhost:8983/solr/ShardTest1_shard1_0_replica1: parsing error
        at
org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:538)
        at
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:235)
        at
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:227)
        at org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1220)
        at
org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:218)
        at
org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:183)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at
org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor$1.run(ExecutorUtil.java:148)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.solr.common.SolrException: parsing error
        at
org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:52)
        at
org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:536)
        ... 12 more
Caused by: java.io.EOFException
        at
org.apache.solr.common.util.FastInputStream.readByte(FastInputStream.java:208)
        at 
org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:188)
        at
org.apache.solr.common.util.JavaBinCodec.readArray(JavaBinCodec.java:508)
        at 
org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:202)
        at
org.apache.solr.common.util.JavaBinCodec.readSolrDocumentList(JavaBinCodec.java:390)
        at 
org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:237)
        at
org.apache.solr.common.util.JavaBinCodec.readOrderedMap(JavaBinCodec.java:135)
        at 
org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:204)
        at
org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:126)
        at
org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:50)
        ... 13 more

Here are the changes to TedQuery (I reduced the amount of data being
returned and map the docId to the document - like the [docid] transformer,
and put the map in the request context in the finish() method)

public void collect(int doc) throws IOException {
                        count++;
                        if (doc % 10000 == 0) {
                                mydata.put(Integer.valueOf(doc + 
super.docBase), String.valueOf(doc +
super.docBase));
                                super.collect(doc);
                        }
                }

public void finish() throws IOException {
...
rb.req.getContext().put("mystats", mydata);
...
}

Here's the transformer:

public class TedTransform extends TransformerFactory {
        @Override
        public DocTransformer create(String arg0, SolrParams arg1, 
SolrQueryRequest
arg2) {
                return new TedTransformer(arg0, arg2);
        }

        private class TedTransformer extends TransformerWithContext {
                private final String f;
                private HashMap<Integer, String> data;

                public TedTransformer(String f, SolrQueryRequest r) {
                        this.f = f;
                }

                @Override
                public String getName() {
                        return null;
                }

                @Override
                public void transform(SolrDocument arg0, int arg1) throws 
IOException {
                        if (context.req != null) {
                        if (data == null) {
                                data = (HashMap<Integer, String>)
context.req.getContext().get("mystats");
                        }
                        arg0.setField(f, data.get(Integer.valueOf(arg1)));
                        }
                }
        }
}

And I added the transformer to the solrconfig.xml:

<transformer name="TedT" class="...TedTransform" />
   <queryParser name="TedFilter" class="...TedPlugin" />
   <requestHandler name="/ted" class="solr.SearchHandler">
           <lst name="appends">
                        <str name="fq">{!TedFilter myvar=hello}</str>
                        <str name="fl">[TedT]</str>
                </lst>
   </requestHandler>

Why does this barf on multi-sharded collections?



--
View this message in context: 
http://lucene.472066.n3.nabble.com/QParsePlugin-not-working-on-sharded-collection-tp4290249p4290390.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to