You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Alexandre Rafalovitch (JIRA)" <ji...@apache.org> on 2016/10/08 04:18:20 UTC
[jira] [Closed] (SOLR-3449) QueryComponent.doFieldSortValues throw
ArrayIndexOutOfBoundsException when has maxDoc=0 Segment
[ https://issues.apache.org/jira/browse/SOLR-3449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexandre Rafalovitch closed SOLR-3449.
---------------------------------------
Resolution: Cannot Reproduce
An old discussion against old code with no next action.
> 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
> 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 was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org