Division by zero error of Solr StatsComponent for a date field in the absence of results

I have a number of documents indexed by Solr 3.5 that contain date fields (solr.DateField) among others. Now I am requesting the Solr component, which should not return any results:

http://example.com/solr/select?fq=sis_field_int:1000&
stats=true&stats.field=ds_field_date

and get an error

HTTP Status 500 - / by zero java.lang.ArithmeticException: / by zero at
org.apache.solr.handler.component.DateStatsValues.addTypeSpecificStats
(StatsValuesFactory.java:384) at ...

If I send a request without statistics or specify any field without a date, I get the expected response without any results. This is similar to a Solr error that is trying, for example. to calculate the average value in this case. Unfortunately, I did not find references to this problem. Is there a way around or solving the problem?

+5
source share
1 answer

You're right, the problem is calculating the average:

res.add("mean", new Date(sum / count));

sum count long. count , ArithmeticException. , . , , count , , , .

, , double, , NaN. StatsValues, .

UPDATE
SOLR-3160 jira , . Solr !

+6

All Articles