For testing, I try to write C#'s Double.MIN (-1.79769313486232E+308) and Double.Max (1.79769313486232E+308) values to a Solr TrieDoubleField by using the library SolrNet. Both double values are send via XML to the Solr server which outputs the following logs:
2018-06-06 13:27:46.840 DEBUG (qtp33524623-14) [ x:Test] o.a.s.u.p.AllValuesOrNoneFieldMutatingUpdateProcessor field 'd_DoubleMin' String value '-1.79769313486232E+308' is not mutable, so no values will be mutated 2018-06-06 13:27:46.840 DEBUG (qtp33524623-14) [ x:Test] o.a.s.u.p.ParseDoubleFieldUpdateProcessorFactory value '1.79769313486232E+308' is not parseable, thus not mutated; unparsed chars: 'E+308' 2018-06-06 13:27:46.840 DEBUG (qtp33524623-14) [ x:Test] o.a.s.u.p.AllValuesOrNoneFieldMutatingUpdateProcessor field 'd_DoubleMax' String value '1.79769313486232E+308' is not mutable, so no values will be mutated
Solrnet uses the scientific notation to pass these double values, but Solr seems to be unable to parse it probably. When I check the content of the added Solr document, both values are set to '-infinity' and 'infinity' respectively.
However, when I write NaN, '-infinity' and 'infinity' to Solr, all values are stored as expected.
I've also checked the Double specification of C# and Solr which seem to be not the same:
Is it a bug of SolrNet or am I missing something?
To solve this problem, I have implemented an own DoubleFieldSerializer (derived from SolrNets AbstractFieldSerializer). My DoubleFieldSerializer calls obj.ToString("R") in the Parse function instead. I did the same for Float values.
A drawback of my solution is that I need to override the DefaultFieldSerializer to be able to register my FieldSerializers (similar to Dans solution).
I've also posted this problem to Github as well. So maybe it will get fixed in the future: https://github.com/SolrNet/SolrNet/issues/422