Hello Folks,
Surprisingly, the value from the following raw data gives me a NFE
(Number Format Exception) when running the DIH (Data Import Handler):
<span class="tgProductPrice">$1,000.00</span>
The error logs look like:
Caused by: org.apache.solr.common.SolrException: Error while creating
field 'price{type=sdouble,properties=indexed,stored,omitNorms,sortMissingLast}'
from value '1,000'
at org.apache.solr.schema.FieldType.createField(FieldType.java:249)
at org.apache.solr.schema.SchemaField.createField(SchemaField.java:102)
at
org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:198)
at
org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:257)
... 13 more
Caused by: java.lang.NumberFormatException: For input string: "1,000"
at
sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222)
at java.lang.Double.parseDouble(Double.java:510)
at
org.apache.solr.util.NumberUtils.double2sortableStr(NumberUtils.java:129)
at
org.apache.solr.schema.SortableDoubleField.toInternal(SortableDoubleField.java:61)
at org.apache.solr.schema.FieldType.createField(FieldType.java:247)
It is pretty obvious from this that the "sdouble" schema fieldtype is
not setup to parse out group-separators from a number.
1) Then my question is which type pf schema fieldtype will parse out
the comma group-separator from 1,000?
2) Also, shouldn't we think about making locale based parsing be part
of this stack trace as well?
at
sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222)
at java.lang.Double.parseDouble(Double.java:510)
at
org.apache.solr.util.NumberUtils.double2sortableStr(NumberUtils.java:129)
Thanks!
- Pulkit