Hello, Sandopolus!

First let me thank you a lot your last e-mail: it showed me the way to
resolve this bug/problem. I´ve implemented a custom BinaryLBHttpSolrServer,
as you suggested, but with your implementation I had the same problems. I
think that it is due to HttpClientUtil.createClient(null). I just modified
it a little and... it worked! My final code is:


*import org.apache.solr.client.solrj.impl.BinaryRequestWriter;*
*import org.apache.solr.client.solrj.impl.HttpSolrServer;*
*import org.apache.solr.client.solrj.impl.LBHttpSolrServer;*

*package com.example.custom.solr;*
*
*
*import java.net.MalformedURLException;*

*public class BinaryLBHttpSolrServer extends LBHttpSolrServer {*
*
*
* private static final long serialVersionUID = 3905956120804659445L;*
* *
*    public BinaryLBHttpSolrServer(String[] endpoints) throws
MalformedURLException {*
*    super(endpoints);*
*    }*
*
*
*    @Override*
*    protected HttpSolrServer makeServer(String server) throws
MalformedURLException {*
*        HttpSolrServer solrServer = super.makeServer(server);*
*        solrServer.setRequestWriter(new BinaryRequestWriter());*
*        return solrServer;*
*    }*
*}*


I hope that this might help to others to solve this very big problem.


Regards,


- Luis Cappa.


2012/11/16 Sandopolus <sandopo...@gmail.com>

> There is a way to make CloudSolrServer use LBHttpSolrServer with the
> BinaryRequestWriter
> that is quite simple as i have had to work around this very problem.
>
> Create a new class which extends LBHttpSolrServer (Call it
> BinaryLBHttpSolrServer or something like that). This class will need to
> setup the LBHttpSolrServer in the Constructor and override the makeServer
> method.
>
> When you are creating the CloudSolrServer create the BinaryLBHttpSolrServer
> first and then pass this into the CloudSolrServer constructor with the ZH
> Host String.
>
> I have put the code for the BinaryLBHttpSolrServer class below and example
> code for creating the CloudSolrServer which will be using the
> BinaryRequestWriter
>
> Ta
>
> Sandy
>
>
>
> Example Code
>
> BinaryLBHttpSolrServer lbSolrServer = new BinaryLBHttpSolrServer();
> CloudSolrServer solrServer = new CloudSolrServer(zkHost, lbSolrServer);
>
> public class BinaryLBHttpSolrServer extends LBHttpSolrServer {
>
>     private RequestWriter requestWriter = new BinaryRequestWriter();
>
>     public BinaryLBHttpSolrServer()
>             throws MalformedURLException {
>         super(HttpClientUtil.createClient(null), new String[0]);
>     }
>
>     @Override
>     protected HttpSolrServer makeServer(String server) throws
> MalformedURLException {
>         HttpSolrServer solrServer = super.makeServer(server);
>         solrServer.setRequestWriter(requestWriter);
>         return solrServer;
>     }
> }
>
>
> On 15 November 2012 16:43, Luis Cappa Banda <luisca...@gmail.com> wrote:
>
> > Yes, my first attemp was with a List<String>, but it didn´t work. Then I
> > started to try another ways such as a String[] array with no success.
> >
> > Regards,
> >
> > - Luis Cappa.
> >
> > 2012/11/15 Sami Siren <ssi...@gmail.com>
> >
> > > hi,
> > >
> > > did you try setting your values in a List, for example ArrayList it
> > should
> > > work when you use that even without specifying reguest-/response
> writer.
> > >
> > > --
> > >  Sami Siren
> > >
> > >
> > > On Thu, Nov 15, 2012 at 4:56 PM, Luis Cappa Banda <luisca...@gmail.com
> > > >wrote:
> > >
> > > > Hello,
> > > >
> > > > I´ve found what It seems to be a bug
> > > > JIRA-SOLR4080<
> > > >
> > >
> >
> https://issues.apache.org/jira/browse/SOLR-4080?focusedCommentId=13498055&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13498055
> > > > >
> > > > with
> > > > CloudSolrServer during atomic updates via SolrJ. Thanks to Sami I
> > > detected
> > > > that the problem could be solved setting BinaryResponseParser as
> Parser
> > > and
> > > > BinaryRequestWriter as Request writer. That workis with
> HttpSolrServer,
> > > but
> > > > CloudSolrServer or LBHttpSolrServer hasn´t got any method to set
> them.
> > > >
> > > > Is there a way to set both parsers to a CloudSolrServer instance? Do
> > you
> > > > know if maybe it could be configured insed solrconfig.xml?
> > > >
> > > > Thanks a lot.
> > > >
> > > > --
> > > >
> > > > - Luis Cappa
> > > >
> > >
> >
> >
> >
> > --
> >
> > - Luis Cappa
> >
>



-- 

- Luis Cappa

Reply via email to