lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: date functions and floats
Date Sat, 15 Aug 2009 15:16:12 GMT

: We could either:
: - change function queries to use doubles internally - probably a good
: idea for the future in general - seems like geo might need more
: precision too.
: - come up with a new date scale function that uses doubles internally?

off the cuff idea i remember thinking of a long time back: couldn't we add 
a "getNativeType():Class" method to either ValueSource or DocValues, which 
callers (and ValueSources that wrap other valuesources) could use to help 
them infer what method to use on DocValues to get the value with the 
highest degree of precision?

by default, it would return Float.TYPE ... but subclasses could override 
it.  leaf subclasses (DoubleFieldSource) could have it return a hardcoded 
value, while sources that wrap other sources and can perform the 
calculation equally well on any type (TopValueSource) could delegate to 
the wrapped source, and sources that add/lose precision as the result of a 
calcaution (ScaleFloatFunction) would return the appropriate value based 
(but not neccessarily equal to) the source they wrap.

the added bonus being: no more casting every value of every field to 
float, if all you really care about is some simple math on an int value 


View raw message