Details
Description
We get an ArrayIndexOutOfBoundsException when searching after upgrading to solr 5.5.
Here's the query:
"params":{ "q":"*:*", "group.sort":"priceAmount asc,rnd desc", "indent":"on", "fl":"priceAmount,flightTripId,brand,slob,cabinType,tripDuration", "group.limit":"100", "fq":["searchId:e31a0c58-9056-4297-8d70-049017ba4906", "doctype:offer", "flightTripId:(DY6020421-SK2360519 OR DY6020421-SK2600519 OR DY6020421-SK2620519 OR DY6020421-SK2740519 OR DY6020421-SK2900519 OR DY6020421-SK2860519 OR DY6040421-SK2380519 OR DY6040421-SK2440519 OR DY6040421-SK2480519 OR DY6040421-SK2520519 OR DY6040421-SK2600519 OR DY6040421-SK2620519 OR DY6040421-SK2720519 OR DY6040421-SK2740519 OR DY6040421-SK2800519 OR DY6040421-SK2840519 OR DY6040421-SK2820519 OR DY6060421-SK2480519 OR DY6060421-SK2740519 OR DY6060421-SK2800519 OR DY6060421-SK2840519 OR DY6060421-SK2900519 OR DY6060421-SK2860519 OR DY6060421-SK2820519 OR DY6080421-SK2440519)", "maximumLegDuration:[* TO 180]", "departureAirportLeg1:(OSL)", "(arrivalAirportLeg2:(OSL) OR (* NOT arrivalAirportLeg2:*))", "arrivalAirportLeg1:(BGO)", "(departureAirportLeg2:(BGO) OR (* NOT departureAirportLeg2:*))"], "group.ngroups":"true", "wt":"json", "group.field":"flightTripId", "group":"true"}}
And here's the exception:
ERROR [20160404T104846,333] qtp315138752-3037 org.apache.solr.servlet.HttpSolrCall - null:java.lang.ArrayIndexOutOfBoundsException: 1
at org.apache.solr.search.grouping.distributed.shardresultserializer.TopGroupsResultTransformer.transformToNativeShardDoc(TopGroupsResultTransformer.java:175)
at org.apache.solr.search.grouping.distributed.shardresultserializer.TopGroupsResultTransformer.transformToNative(TopGroupsResultTransformer.java:137)
at org.apache.solr.search.grouping.distributed.responseprocessor.TopGroupsShardResponseProcessor.process(TopGroupsShardResponseProcessor.java:129)
at org.apache.solr.handler.component.QueryComponent.handleGroupedResponses(QueryComponent.java:750)
at org.apache.solr.handler.component.QueryComponent.handleResponses(QueryComponent.java:733)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:405)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:155)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:2082)
The exception is thrown at the last line here (TopGroupsResultTransformer.java line 175):
protected ScoreDoc[] transformToNativeShardDoc(List<NamedList<Object>> documents, Sort groupSort, String shard, IndexSchema schema) { [...] for (NamedList<Object> document : documents) { [...] Object sortValuesVal = document.get("sortValues"); if (sortValuesVal != null) { sortValues = ((List) sortValuesVal).toArray(); for (int k = 0; k < sortValues.length; k++) { SchemaField field = groupSort.getSort()[k].getField() != null ? schema.getFieldOrNull(groupSort.getSort()[k].getField()) : null;
It's not obvious to me that sortValues.length == groupSort.getSort().length, but I guess there's some logic behind it
I have attached the schema and json result.
The problem disappears when rolling back to 5.4.0.
Attachments
Attachments
Issue Links
- is broken by
-
LUCENE-6900 Grouping sortWithinGroup should use Sort.RELEVANCE to indicate that, not null
- Closed