Linbin Chen created SOLR-3449:
---------------------------------

             Summary: 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.1
         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:
//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。
correct idx=5。


--
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: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to