Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7543981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:34:06+00:00 2026-05-30T08:34:06+00:00

I have a number of docs indexed by Solr 3.5, which contain date fields

  • 0

I have a number of docs indexed by Solr 3.5, which contain date fields (solr.DateField) among others. Now I do request to Solr component which should return no results:

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

and get 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 request without stats part or specify any non-date stats field instead, I get expected response with no results. It looks like a bug of Solr which tries e.g. to calculate mean value in this case. Unfortunately I’ve found no references on this problem. Is there some way to bypass or solve the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:34:07+00:00Added an answer on May 30, 2026 at 8:34 am

    You’re right, the problem is computing the mean value:

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

    sum and count are both long. When count is zero, of course you get an ArithmeticException. You’re actually making stats on a date field which never has a value in your index. The easiest workaround would be making stats on a field which has at least one value, so the count variable would be greather than zero, the division will work, and the stats would be even more meaningful I guess.

    You don’t get the same error with the same situation using a numeric field, because in that case the sum variable is double, thus the division don’t raise error and the result is NaN. In fact, there are different StatsValues implementations based on the field type.

    UPDATE
    I’ve opened the SOLR-3160 jira issue and provided a patch which has just been committed. The next release of Solr will contain the fix!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My docs contain lists of errors. I have a view which counts the number
I have a number of documents which look like this: {userId: 123, msg:{ timestamp:123456,
I have a number of docs with following structure. { _id:, url:, users_linked:[1,2,3...] }
I have a number of strings that represent numbers which use commas or points
I have an iPhone application in which a number of domain objects are populated
I'm setting up a number sites right now and many of them have multiple
I have number of line breaks in a string. But I only want it
I'm stuck with the following scenario and appreciate any help/advice.. Requirement I have number
I have a number input that should trigger jQuery on every change. To do
I have a number of classes and they are quite close to each other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.