: But why Solr Field is not having a method to retrieve values for all data : types? : something similar to : Object obj = doc.getField("Field1"); : : Why only stringvalue is exposed in this Field class? : : doc.getField("Field1").stringValue()
Lucene's "Document" objecta is a very low level representation of the data that doens't know about the Solr schema. The method you are looking for is FieldType.toObject(...). For any given field name, you ask the IndexSchema what the coorisponding FieldType is, and then you ask the FieldType to convert the stored values into the appropriate object representation. Take a look at the SolrPluginUtils.docListToSolrDocumentList helper method. -Hoss