[hibernate-dev] [Search] 3.4.1: HSEARCH-776 fix causes index out of bound exception

Elmer van Chastelet evanchastelet at gmail.com
Mon Aug 29 13:00:27 EDT 2011


Hi again,

I just upgraded to from HS 3.4.0 to 3.4.1.
When using range faceting, I get this exception:

--------------------
exception message: toIndex = 3
java.lang.IndexOutOfBoundsException: toIndex = 3
	at java.util.ArrayList.subListRangeCheck(ArrayList.java:885)
	at java.util.ArrayList.subList(ArrayList.java:877)
	at org.hibernate.search.query.collector.FacetCollector.createSortedFacetList(FacetCollector.java:139)
	at org.hibernate.search.query.collector.FacetCollector.getFacetList(FacetCollector.java:128)
	at org.hibernate.search.query.engine.impl.QueryHits.updateTopDocs(QueryHits.java:236)
	at org.hibernate.search.query.engine.impl.QueryHits.<init>(QueryHits.java:127)
	at org.hibernate.search.query.engine.impl.HSQueryImpl.getQueryHits(HSQueryImpl.java:419)
	at org.hibernate.search.query.engine.impl.HSQueryImpl.queryDocumentExtractor(HSQueryImpl.java:275)
	at org.hibernate.search.query.engine.impl.FacetManagerImpl.getFacets(FacetManagerImpl.java:111)
	at org.webdsl.search.AbstractEntitySearcher.getFacets(AbstractEntitySearcher.java:520)
http://pastebin.com/43C2c3Ld
---------------------

Probably it is introduced by the fix for https://hibernate.onjira.com/browse/HSEARCH-776
The fix in 3.4.1 is different from my fix which I've attached in HSEARCH-776. When I replace the FacetCollector.java in the 3.4.1 source with mine, I don't get this exception.

We don't use the query builder, but construct the faceting request directly from our syntax:

--------------------
FacetingRequestImpl rfr = new RangeFacetRequest<T>( facetName(field), field, facetRangeList, documentBuilder );
		rfr.setSort( FacetSortOrder.RANGE_DEFINITION_ODER );
		rfr.setIncludeZeroCounts( false );
		rfr.setMaxNumberOfFacets( facetRangeList.size() );
http://pastebin.com/j2kg9wxt
--------------------

I think it has something to do with the facetRequest.getMaxNumberOfFacets() and IncludeZeroCounts.
New Jira issue, reopen, ... ?

Elmer




More information about the hibernate-dev mailing list