Re: Setting request method to post on SolrQuery causes ClassCastException
A quick work-around is, I think, to tell Solr to use the non-binary response, e.g. wt=xml (I think that's the syntax). Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: syoung [EMAIL PROTECTED] To: solr-user@lucene.apache.org Sent: Wednesday, September 17, 2008 7:27:30 PM Subject: Setting request method to post on SolrQuery causes ClassCastException Hi, I need to have queries over a certain length done as a post instead of a get. However, when I set the method to post, I get a ClassCastException. Here is the code: public QueryResponse query(SolrQuery solrQuery) { QueryResponse response = null; try { if (solrQuery.toString().length() MAX_URL_LENGTH) response = server.query(solrQuery, SolrRequest.METHOD.POST); else response = server.query(solrQuery, SolrRequest.METHOD.GET); } catch (SolrServerException e) { throw new DataAccessResourceFailureException(e.getMessage(), e); } return response; } And the stack trace: java.lang.ClassCastException: java.lang.String org.apache.solr.common.util.NamedListCodec.unmarshal(NamedListCodec.java:89) org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39) org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:385) org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:183) org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90) org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:113) com.localmatters.guidespot.util.SolrTemplate.query(SolrTemplate.java:33) Thanks, Susan -- View this message in context: http://www.nabble.com/Setting-request-method-to-post-on-SolrQuery-causes-ClassCastException-tp19543232p19543232.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Setting request method to post on SolrQuery causes ClassCastException
I guess the post is not sending the correct 'wt' parameter. try setting wt=javabin explicitly . wt=xml may not work because the parser still is binary. check this http://wiki.apache.org/solr/Solrj#xmlparser On Thu, Sep 18, 2008 at 11:49 AM, Otis Gospodnetic [EMAIL PROTECTED] wrote: A quick work-around is, I think, to tell Solr to use the non-binary response, e.g. wt=xml (I think that's the syntax). Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: syoung [EMAIL PROTECTED] To: solr-user@lucene.apache.org Sent: Wednesday, September 17, 2008 7:27:30 PM Subject: Setting request method to post on SolrQuery causes ClassCastException Hi, I need to have queries over a certain length done as a post instead of a get. However, when I set the method to post, I get a ClassCastException. Here is the code: public QueryResponse query(SolrQuery solrQuery) { QueryResponse response = null; try { if (solrQuery.toString().length() MAX_URL_LENGTH) response = server.query(solrQuery, SolrRequest.METHOD.POST); else response = server.query(solrQuery, SolrRequest.METHOD.GET); } catch (SolrServerException e) { throw new DataAccessResourceFailureException(e.getMessage(), e); } return response; } And the stack trace: java.lang.ClassCastException: java.lang.String org.apache.solr.common.util.NamedListCodec.unmarshal(NamedListCodec.java:89) org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39) org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:385) org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:183) org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90) org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:113) com.localmatters.guidespot.util.SolrTemplate.query(SolrTemplate.java:33) Thanks, Susan -- View this message in context: http://www.nabble.com/Setting-request-method-to-post-on-SolrQuery-causes-ClassCastException-tp19543232p19543232.html Sent from the Solr - User mailing list archive at Nabble.com. -- --Noble Paul
Re: Setting request method to post on SolrQuery causes ClassCastException
I tried setting the 'wt' parameter to both 'xml' and 'javabin'. Neither worked. However, setting the parser on the server to XMLResponseParser did fix the problem. Thanks for the help. Susan Noble Paul നോബിള് नोब्ळ् wrote: I guess the post is not sending the correct 'wt' parameter. try setting wt=javabin explicitly . wt=xml may not work because the parser still is binary. check this http://wiki.apache.org/solr/Solrj#xmlparser On Thu, Sep 18, 2008 at 11:49 AM, Otis Gospodnetic [EMAIL PROTECTED] wrote: A quick work-around is, I think, to tell Solr to use the non-binary response, e.g. wt=xml (I think that's the syntax). Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: syoung [EMAIL PROTECTED] To: solr-user@lucene.apache.org Sent: Wednesday, September 17, 2008 7:27:30 PM Subject: Setting request method to post on SolrQuery causes ClassCastException Hi, I need to have queries over a certain length done as a post instead of a get. However, when I set the method to post, I get a ClassCastException. Here is the code: public QueryResponse query(SolrQuery solrQuery) { QueryResponse response = null; try { if (solrQuery.toString().length() MAX_URL_LENGTH) response = server.query(solrQuery, SolrRequest.METHOD.POST); else response = server.query(solrQuery, SolrRequest.METHOD.GET); } catch (SolrServerException e) { throw new DataAccessResourceFailureException(e.getMessage(), e); } return response; } And the stack trace: java.lang.ClassCastException: java.lang.String org.apache.solr.common.util.NamedListCodec.unmarshal(NamedListCodec.java:89) org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39) org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:385) org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:183) org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90) org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:113) com.localmatters.guidespot.util.SolrTemplate.query(SolrTemplate.java:33) Thanks, Susan -- View this message in context: http://www.nabble.com/Setting-request-method-to-post-on-SolrQuery-causes-ClassCastException-tp19543232p19543232.html Sent from the Solr - User mailing list archive at Nabble.com. -- --Noble Paul -- View this message in context: http://www.nabble.com/Setting-request-method-to-post-on-SolrQuery-causes-ClassCastException-tp19543232p19557138.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Setting request method to post on SolrQuery causes ClassCastException
it is surprising as to why this happens the the javabin offers significant perf improvements over the xml one. probably you can also try this requestHandler name=/search class=org.apache.solr.handler.component.SearchHandler lst name=defaults str name=wtjavabin/str /lst /requestHandler On Thu, Sep 18, 2008 at 10:17 PM, syoung [EMAIL PROTECTED] wrote: I tried setting the 'wt' parameter to both 'xml' and 'javabin'. Neither worked. However, setting the parser on the server to XMLResponseParser did fix the problem. Thanks for the help. Susan Noble Paul നോബിള് नोब्ळ् wrote: I guess the post is not sending the correct 'wt' parameter. try setting wt=javabin explicitly . wt=xml may not work because the parser still is binary. check this http://wiki.apache.org/solr/Solrj#xmlparser On Thu, Sep 18, 2008 at 11:49 AM, Otis Gospodnetic [EMAIL PROTECTED] wrote: A quick work-around is, I think, to tell Solr to use the non-binary response, e.g. wt=xml (I think that's the syntax). Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: syoung [EMAIL PROTECTED] To: solr-user@lucene.apache.org Sent: Wednesday, September 17, 2008 7:27:30 PM Subject: Setting request method to post on SolrQuery causes ClassCastException Hi, I need to have queries over a certain length done as a post instead of a get. However, when I set the method to post, I get a ClassCastException. Here is the code: public QueryResponse query(SolrQuery solrQuery) { QueryResponse response = null; try { if (solrQuery.toString().length() MAX_URL_LENGTH) response = server.query(solrQuery, SolrRequest.METHOD.POST); else response = server.query(solrQuery, SolrRequest.METHOD.GET); } catch (SolrServerException e) { throw new DataAccessResourceFailureException(e.getMessage(), e); } return response; } And the stack trace: java.lang.ClassCastException: java.lang.String org.apache.solr.common.util.NamedListCodec.unmarshal(NamedListCodec.java:89) org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39) org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:385) org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:183) org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90) org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:113) com.localmatters.guidespot.util.SolrTemplate.query(SolrTemplate.java:33) Thanks, Susan -- View this message in context: http://www.nabble.com/Setting-request-method-to-post-on-SolrQuery-causes-ClassCastException-tp19543232p19543232.html Sent from the Solr - User mailing list archive at Nabble.com. -- --Noble Paul -- View this message in context: http://www.nabble.com/Setting-request-method-to-post-on-SolrQuery-causes-ClassCastException-tp19543232p19557138.html Sent from the Solr - User mailing list archive at Nabble.com. -- --Noble Paul
Setting request method to post on SolrQuery causes ClassCastException
Hi, I need to have queries over a certain length done as a post instead of a get. However, when I set the method to post, I get a ClassCastException. Here is the code: public QueryResponse query(SolrQuery solrQuery) { QueryResponse response = null; try { if (solrQuery.toString().length() MAX_URL_LENGTH) response = server.query(solrQuery, SolrRequest.METHOD.POST); else response = server.query(solrQuery, SolrRequest.METHOD.GET); } catch (SolrServerException e) { throw new DataAccessResourceFailureException(e.getMessage(), e); } return response; } And the stack trace: java.lang.ClassCastException: java.lang.String org.apache.solr.common.util.NamedListCodec.unmarshal(NamedListCodec.java:89) org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39) org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:385) org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:183) org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90) org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:113) com.localmatters.guidespot.util.SolrTemplate.query(SolrTemplate.java:33) Thanks, Susan -- View this message in context: http://www.nabble.com/Setting-request-method-to-post-on-SolrQuery-causes-ClassCastException-tp19543232p19543232.html Sent from the Solr - User mailing list archive at Nabble.com.