[ 
https://issues.apache.org/jira/browse/SOLR-3605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13424377#comment-13424377
 ] 

Serdyn du Toit commented on SOLR-3605:
--------------------------------------

For Solr 3.6 (not sure if this bug is present in Solr 4+)

I have added a test that catches the bug to this ticket.  The error is thrown 
by the JavaBinCodec but I think its because bad data is sent to it.

For my usecase the Grouping class constructs a DocSlice as follows:
org.apache.solr.search.DocSlice@c792d4[offset=10,len=-10,docs={},scores={},matches=0,maxScore=-Infinity]

When I compared this to non-grouped operations the negative 'len' variable 
seemed spurious - as did the 'maxScore' value.  It is this negative 'len' value 
which causes the JavaBinCodec to fail.

In the Grouping class I replaced
      int len = docsGathered - offset;
with
      int len = docsGathered - offset;
      // quick hack to fix the bug:
      if (len < 0)
          len = 0;

I would appreciate if a Solr committer familiar with the Grouping functionality 
can turn my hack into a fix and commit it.

Much appreciated

                
> Problem with group paging (or JavaBinCodec conversion error for the request)
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-3605
>                 URL: https://issues.apache.org/jira/browse/SOLR-3605
>             Project: Solr
>          Issue Type: Bug
>          Components: clients - java, search
>    Affects Versions: 3.5, 3.6
>         Environment: Problem first encountered in running Solr 3.5 under 
> Ubuntu.  Now upgraded to Solr 3.6 but the problem is still present.
>            Reporter: Serdyn du Toit
>              Labels: group, javabincodec, paging, solrj
>         Attachments: TestBinaryResponseWriterError2.txt
>
>
> With Solr 3.6 the following Solr request fails:
> (using the example configuration)
> SolrQuery solrQuery = new SolrQuery();
> solrQuery.setQuery("tshirt");
> solrQuery.setQueryType("search");
> solrQuery.add(GroupParams.GROUP, "true");
> solrQuery.add(GroupParams.GROUP_FORMAT, "grouped");
> solrQuery.add(GroupParams.GROUP_MAIN, "true");
> solrQuery.add(GroupParams.GROUP_FIELD, "manu_exact");
> solrQuery.setStart(30);
> solrQuery.setRows(30);
> org.apache.solr.client.solrj.SolrServerException: Error executing query
>       at 
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:95)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:311) 
> ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
> //    at 
> com.core.util.integration.solr.dao.SolrUtil.executeQuery(SolrUtil.java:204) 
> ~[classes/:na]
> //    at 
> com.blapit.integration.v1.deals.restendpoints.endpoints.test.DealsByKeywordSearchEndpointFuncTest.test(DealsByKeywordSearchEndpointFuncTest.java:40)
>  [classes/:na]
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[na:1.7.0_147-icedtea]
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
> ~[na:1.7.0_147-icedtea]
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[na:1.7.0_147-icedtea]
>       at java.lang.reflect.Method.invoke(Method.java:601) 
> ~[na:1.7.0_147-icedtea]
>       at junit.framework.TestCase.runTest(TestCase.java:168) 
> [junit-4.10.jar:na]
>       at junit.framework.TestCase.runBare(TestCase.java:134) 
> [junit-4.10.jar:na]
>       at junit.framework.TestResult$1.protect(TestResult.java:110) 
> [junit-4.10.jar:na]
>       at junit.framework.TestResult.runProtected(TestResult.java:128) 
> [junit-4.10.jar:na]
>       at junit.framework.TestResult.run(TestResult.java:113) 
> [junit-4.10.jar:na]
>       at junit.framework.TestCase.run(TestCase.java:124) [junit-4.10.jar:na]
>       at junit.framework.TestSuite.runTest(TestSuite.java:243) 
> [junit-4.10.jar:na]
>       at junit.framework.TestSuite.run(TestSuite.java:238) [junit-4.10.jar:na]
>       at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) 
> [junit-4.10.jar:na]
>       at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>  [.cp/:na]
>       at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>  [.cp/:na]
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>  [.cp/:na]
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>  [.cp/:na]
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>  [.cp/:na]
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>  [.cp/:na]
> Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to 
> java.util.List
>       at 
> org.apache.solr.common.util.JavaBinCodec.readSolrDocumentList(JavaBinCodec.java:340)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:207) 
> ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.common.util.JavaBinCodec.readOrderedMap(JavaBinCodec.java:111)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:174) 
> ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:102) 
> ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:469)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:249)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       ... 22 common frames omitted
> If I change the start parameter to something else:
> org.apache.solr.client.solrj.SolrServerException: Error executing query
>       at 
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:95)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:311) 
> ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
> //    at 
> com.core.util.integration.solr.dao.SolrUtil.executeQuery(SolrUtil.java:204) 
> ~[classes/:na]
> //    at 
> com.blapit.integration.v1.deals.restendpoints.endpoints.test.DealsByKeywordSearchEndpointFuncTest.test(DealsByKeywordSearchEndpointFuncTest.java:40)
>  [classes/:na]
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[na:1.7.0_147-icedtea]
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
> ~[na:1.7.0_147-icedtea]
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[na:1.7.0_147-icedtea]
>       at java.lang.reflect.Method.invoke(Method.java:601) 
> ~[na:1.7.0_147-icedtea]
>       at junit.framework.TestCase.runTest(TestCase.java:168) 
> [junit-4.10.jar:na]
>       at junit.framework.TestCase.runBare(TestCase.java:134) 
> [junit-4.10.jar:na]
>       at junit.framework.TestResult$1.protect(TestResult.java:110) 
> [junit-4.10.jar:na]
>       at junit.framework.TestResult.runProtected(TestResult.java:128) 
> [junit-4.10.jar:na]
>       at junit.framework.TestResult.run(TestResult.java:113) 
> [junit-4.10.jar:na]
>       at junit.framework.TestCase.run(TestCase.java:124) [junit-4.10.jar:na]
>       at junit.framework.TestSuite.runTest(TestSuite.java:243) 
> [junit-4.10.jar:na]
>       at junit.framework.TestSuite.run(TestSuite.java:238) [junit-4.10.jar:na]
>       at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) 
> [junit-4.10.jar:na]
>       at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>  [.cp/:na]
>       at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>  [.cp/:na]
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>  [.cp/:na]
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>  [.cp/:na]
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>  [.cp/:na]
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>  [.cp/:na]
> Caused by: java.lang.IndexOutOfBoundsException: Index: 16, Size: 14
>       at java.util.ArrayList.rangeCheck(ArrayList.java:604) 
> ~[na:1.7.0_147-icedtea]
>       at java.util.ArrayList.get(ArrayList.java:382) ~[na:1.7.0_147-icedtea]
>       at 
> org.apache.solr.common.util.JavaBinCodec.readExternString(JavaBinCodec.java:708)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:178) 
> ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.common.util.JavaBinCodec.readSolrDocumentList(JavaBinCodec.java:340)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:207) 
> ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.common.util.JavaBinCodec.readOrderedMap(JavaBinCodec.java:111)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:174) 
> ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:102) 
> ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:469)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:249)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       at 
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)
>  ~[apache-solr-solrj-3.6.0.jar:3.6.0 1310449 - rmuir - 2012-04-06 11:34:08]
>       ... 22 common frames omitted
> The following observations might help finding the problem:
> 1) The query works when not using SolrJ (remember Solr will append 
> &wt=javabin&version=2 to the query sent to Solr) - thereby indicating that 
> this is possibly not a problem with the group functionality itself but with 
> the JavaBinCodec.
> 2) The responses I get from the server using the JavaBinCodec differs between 
> the requests (even though they all should return zero results) - so there is 
> a difference in the response from a server which can't be parsed. Maybe these 
> differences in the responses received from the server is correct and the 
> error is in the clients JavaBinCodec?
> 3) Still searching for a keyword but setting the start parameter to zero - 
> the query succeeds.
> 4) Not searching for a keyword all paging parameters work.
> Hope that helps...  So iets either in the client's JavaBinCodec, the server's 
> JavaBinCodec, or something in the group functionality itself.  And the issue 
> only appears (as indicated in 3 and 4 above) when doing keyword searches for 
> pages that don't start at zero.
> Thank you very much for any help.  Please let me know if I can assist with 
> anything.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to