: : Looking into the code I found out that all the field types implement : FieldType, that's fine, but maybe we can refactor that so we have more : levels like:
...the goal being that then your extended facet code could add the extra stats when it sees that the field type extends NumericFieldType? That seems fine to me ... but a more robust solution might be to just introspec toObject() method on the fieldtype, and test if that extends Number (then your code will work even if people write their own field types that don't extend NumericFieldType) That assumes you are using toObject to get the values to do computation on ... if you're using ValueSources then you don't have to worry about it at all -- every field supports it, even the non numeric ones (using OrdFieldSource) .. if the user asks you to give him the standard deviation of a string field i think it's fine to give back a bogus answer (or you could put a special case in and return "not applicable" if the ValueSource is an OrdFieldSource) -Hoss