Reputation: 62
I have a solr schema with a field in long type
<field name="source_raw_hash" type="long" indexed="true" stored="true"/>
the long type in the schema is the default:
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
I am saving to the index in solrJ, the value: 3954983690244748504 to this field, but it's being saved as 3954983690244748300
I am having the same with different large values.
Tried change the type to double with is 64 as well, didn't work also.
I am using solr 5.3 and solrj 5.3
Upvotes: 1
Views: 639
Reputation: 52882
You're not indexing longs, you're indexing doubles. Meaning that before the content hits Solr, you're probably storing it as a double somewhere.
When stored as a double, 3954983690244748504
can only be expressed as 3.9549836902447483e+18
(or without the scientific notation, 3954983690244748300
), which matches your second number.
doubles are not exact, they're an approximation - also when it comes to very large numbers.
Upvotes: 1