I've inherited some code which uses the Lucene API to query a Solr index.
The code does a lot of searches, and at the end converts all found lucene documents to solr documents:
// doc:Document
val sdoc = new SolrDocument
for (f:Fieldable <- doc.getFields if f.isStored) {
sdoc.addField(f.name(),f.stringValue())
}
This works fine, except for when the field value isn't a string, e.g. floats or booleans. On float fields, stringValue()
returns some weird characters (e.g. ¿£൱), presumably the string representation of a float.
How do I properly get the float value from a Lucene document?