lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: FieldCacheImpl mistake?
Date Thu, 15 Feb 2007 08:51:46 GMT

: The array of floats for the Float cache is not initialised. Which means that
: it will return '0.0' (not initialised) as the value for those documents that
: have a '0' as the value, as well as for those ones that do not have the
: field.

you may find this class interesting...
http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java

:   i suggest it could be defined a (e.g.) NOT_FOUND_FLOAT_VALUE, modifiable,
: so it does not necessarily have to be 0. And used for initialise the array
: of floats before processing (or do it on the loop if better performance can
: be reached).
:   I have set it to Float.NEGATIVE_INFINITY

this sounds like a generally usable feature ... although we wouldn't want
it to be a single for hte whole field cache because then code expecting
the defaults to be Float.NEGATIVE_INFINITY could be suprised if other code
(perhaps even dealing with different fields) populated the cache first.

the ideal way to do this might be to add a "getDefault()" method to the
IntParser and FloatParser interfaces ... but thta wouldn't be backwards
compatible.

one (kludgy) possibility would be to use a single call to
FloatParser.parseFloat(null) to determine what value to use -- if it
throws an exception use "0.0", otherwise use whatever it returns, what are
the odds that an existing FloatParser that doesn't balk on null isn't
going to return something that makes sense as a default?


-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message