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

Bruce Butterfield commented on SOLR-3449:
-----------------------------------------

This patch fixed an issue in our system; we do lots of merges and were getting 
sporadic ArrayIndexOutOfBounds execeptions when including any sort parameters 
to the query. Please incorporate this into 3.6.2.
                
> QueryComponent.doFieldSortValues throw ArrayIndexOutOfBoundsException when 
> has maxDoc=0 Segment
> -----------------------------------------------------------------------------------------------
>
>                 Key: SOLR-3449
>                 URL: https://issues.apache.org/jira/browse/SOLR-3449
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 3.5, 3.6
>            Reporter: Linbin Chen
>             Fix For: 3.6.2
>
>         Attachments: SOLR-3449.patch
>
>
> have index
> {code}
> Segment name=_9, offest=[docBase=0, maxDoc=245] idx=0
> Segment name=_a, offest=[docBase=245, maxDoc=3] idx=1
> Segment name=_b, offest=[docBase=248, maxDoc=0] idx=2
> Segment name=_c, offest=[docBase=248, maxDoc=1] idx=3
> Segment name=_d, offest=[docBase=249, maxDoc=0] idx=4
> Segment name=_e, offest=[docBase=249, maxDoc=1] idx=5
> Segment name=_f, offest=[docBase=250, maxDoc=0] idx=6
> Segment name=_g, offest=[docBase=250, maxDoc=3] idx=7
> Segment name=_h, offest=[docBase=253, maxDoc=0] idx=8
> {code}
> maxDoc=0 's Segment maybe create by mergeIndexes。(can make sure maxDoc=0 's 
> segment not merge, but when couldn't control merge indexes)
> when use fsv=true get sort values, hit docId=249 throw 
> ArrayIndexOutOfBoundsException
> {code}
> 2012-5-11 14:28:28 org.apache.solr.common.SolrException log
> ERROR: java.lang.ArrayIndexOutOfBoundsException: 0
>         at 
> org.apache.lucene.search.FieldComparator$LongComparator.copy(FieldComparator.java:600)
>         at 
> org.apache.solr.handler.component.QueryComponent.doFieldSortValues(QueryComponent.java:463)
>         at 
> org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:400)
> {code}
> reason:
> {code}
> //idx              0    1    2    3    4    5    6    7    8
> //int[] maxDocs={245,   3,   0,   1,   0,   1,   0,   3,   0};
> int[] offsets = {  0, 245, 248, 248, 249, 249, 250, 250, 253};
> org.apache.solr.search.SolrIndexReader.readerIndex(249, offsets) return idx=4 
> not 5。
> {code}
> correct idx=5。
> patch
> {code}
> Index: solr/core/src/java/org/apache/solr/search/SolrIndexReader.java
> ===================================================================
> --- solr/core/src/java/org/apache/solr/search/SolrIndexReader.java    
> (revision 1337028)
> +++ solr/core/src/java/org/apache/solr/search/SolrIndexReader.java    
> (working copy)
> @@ -138,6 +138,16 @@
>        }
>        else {
>          // exact match on the offset.
> +     //skip equal offest
> +             for(int i=mid+1; i<=high; i++) {
> +                     if(doc == offsets[i]) {
> +                             //skip offests[i] == doc
> +                     mid = i;
> +                     } else {
> +                             //stop skip offest
> +                             break;
> +                     }
> +             }
>          return mid;
>        }
>      }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to